Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 3, 2013, 8:18:15 PM (12 years ago)
Author:
zifloria
Message:

End game screen. Eye candy. Gameplay tweaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/invaders/src/modules/invader/InvaderShip.cc

    r9829 r9868  
    4242    RegisterClass(InvaderShip);
    4343
    44     /**
    45     @brief
    46         Constructor. Registers and initializes the object.
    47     */
    4844    InvaderShip::InvaderShip(Context* context) : SpaceShip(context)
    4945    {
     
    7874            if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3)
    7975                velocity.x = 0;
    80             // this->setVelocity(Vector3(1000 + velocity.y, 0, velocity.x));
    8176            pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt;
    8277        }
    8378
     79        // shoot!
    8480        if (isFireing)
    8581            ControllableEntity::fire(0);
     
    9187            camera->setPosition(Vector3(-pos.z, -posforeward, 0));
    9288            camera->setOrientation(Vector3::UNIT_Z, Degree(90));
    93             // orxout() << "asbhajskjasjahg" << pos << endl;
    9489        }
    9590
     
    9792
    9893        // bring back on track!
    99         // if (pos.z > 42*2.5)
    100         //     pos.z = 42*2.5;
    101         // else if (pos.z < -42*3)
    102         //     pos.z = -42*3;
    10394        if(pos.y != 0)
    10495            pos.y = 0;
    105            
    10696
    10797        setPosition(pos);
     
    122112        lastTime = 0;
    123113        if (getGame())
    124         {
    125114            getGame()->levelUp();
    126             // SmartPtr<Invader> game = orxonox_cast<Invader>(getGametype());
    127            
    128         }
    129         //level++
    130115    }
    131116
     
    144129    {
    145130        isFireing = bBoost;
     131        // restart if game ended
     132        if (getGame())
     133            if (getGame()->bEndGame)
     134                getGame()->start();
    146135    }
    147136    inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    148137    {
    149138        // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint;
    150 
    151139        WeakPtr<InvaderEnemy> enemy = orxonox_cast<InvaderEnemy*>(otherObject);
     140        // ensure that this gets only called once per enemy.
    152141        if (enemy != NULL && lastEnemy != enemy)
    153142        {
    154143            lastEnemy = enemy;
    155             orxout() << "Enemy!!!! " << endl;
     144
    156145            removeHealth(20);
    157             if (getHealth() <= 0)
     146            if (getGame())
    158147            {
    159                 orxout() << "DIED!!!! " << endl;
    160                 if (getGame())
    161                 {
    162                     getGame()->costLife();
    163                     // SmartPtr<Invader> game = orxonox_cast<Invader>(getGametype());
    164                    
    165                 }
     148                getGame()->multiplier = 1;
     149                if (getHealth() <= 0)
     150                    getGame()->costLife();                   
    166151            }
    167152            return false;
Note: See TracChangeset for help on using the changeset viewer.