Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 22, 2014, 3:05:46 PM (10 years ago)
Author:
fvultier
Message:

new items added. improved level generator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickupsFS14/src/modules/jump/JumpEnemy.cc

    r10050 r10074  
    5656        RegisterObject(JumpEnemy);
    5757
    58         this->figure_ = 0;
     58        dead_ = false;
     59        figure_ = 0;
     60        width_ = 0.0;
     61        height_ = 0.0;
     62        setPosition(Vector3(0,0,0));
     63        setVelocity(Vector3(0,0,0));
     64        setAcceleration(Vector3(0,0,0));
    5965        setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    60         this->setPosition(Vector3(0,0,0));
    61         this->setVelocity(Vector3(0,0,0));
    62         this->setAcceleration(Vector3(0,0,0));
    6366    }
    6467
     
    8285    {
    8386        SUPER(JumpEnemy, XMLPort, xmlelement, mode);
     87
     88        XMLPortParam(JumpEnemy, "height", setHeight, getHeight, xmlelement, mode);
     89        XMLPortParam(JumpEnemy, "width", setWidth, getWidth, xmlelement, mode);
    8490    }
    8591
     
    116122
    117123
     124        // Interact with Figure
     125        Vector3 enemyPosition = getPosition();
     126
     127        if (figure_ != NULL)
     128        {
     129            Vector3 figurePosition = figure_->getPosition();
     130            if(figurePosition.x > enemyPosition.x-width_ && figurePosition.x < enemyPosition.x+width_ && figurePosition.z > enemyPosition.z-height_ && figurePosition.z < enemyPosition.z+height_)
     131            {
     132                touchFigure();
     133            }
     134        }
    118135    }
    119136
     
    141158    void JumpEnemy::touchFigure()
    142159    {
    143 
     160        if (dead_ == false)
     161        {
     162                figure_->CollisionWithEnemy(this);
     163        }
    144164    }
    145165}
Note: See TracChangeset for help on using the changeset viewer.