Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 25, 2013, 5:35:30 PM (10 years ago)
Author:
zifloria
Message:

HUD + take damage

File:
1 edited

Legend:

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

    r9793 r9828  
    7070        {
    7171            float dist_y = velocity.y * dt;
     72            float dist_x = velocity.x * dt;
    7273            if(dist_y + posforeward > -42*3 && dist_y + posforeward < 42*6)
    7374                posforeward += dist_y;
    7475            else
    7576                velocity.y = 0;
     77            if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3)
     78                velocity.x = 0;
    7679            // this->setVelocity(Vector3(1000 + velocity.y, 0, velocity.x));
    7780            pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt;
     
    9396
    9497        // bring back on track!
    95         if (pos.z > 42*2.5)
    96             pos.z = 42*2.5;
    97         else if (pos.z < -42*3)
    98             pos.z = -42*3;
     98        // if (pos.z > 42*2.5)
     99        //     pos.z = 42*2.5;
     100        // else if (pos.z < -42*3)
     101        //     pos.z = -42*3;
    99102        if(pos.y != 0)
    100103            pos.y = 0;
    101         // if (camera != NULL)
    102         // {
    103         //     float x = camera->getWorldPosition().x;
    104         //     if (pos.x > x + 20)
    105         //         pos.x = x + 20;
    106         //     else if (pos.x < x - 20)
    107         //         pos.x = x - 20;
    108         // }
    109         // if (abs(posforeward) < 20)
    110104           
    111105
     
    114108
    115109        // Level up!
    116         if (pos.x > 30000)
     110        if (pos.x > 42000)
    117111        {
    118112            updateLevel();
    119             setPosition(Vector3(0, 0, 0)); // pos - Vector3(30000, 0, 0)
     113            setPosition(Vector3(0, 0, pos.z)); // pos - Vector3(30000, 0, 0)
    120114        }
    121115
     
    144138        isFireing = bBoost;
    145139    }
     140    inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     141    {
     142        // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint;
     143
     144        WeakPtr<InvaderEnemy> enemy = orxonox_cast<InvaderEnemy*>(otherObject);
     145        if (enemy != NULL && lastEnemy != enemy)
     146        {
     147            lastEnemy = enemy;
     148            orxout() << "Enemy!!!! " << endl;
     149            removeHealth(20);
     150            if (getHealth() <= 0)
     151            {
     152                orxout() << "DIED!!!! " << endl;
     153            }
     154            return false;
     155        }
     156        return false;
     157        // SUPER(InvaderShip, collidesAgainst, otherObject, contactPoint);
     158    }
    146159}
Note: See TracChangeset for help on using the changeset viewer.