- Timestamp:
- Dec 3, 2013, 8:18:15 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/invaders/src/modules/invader/InvaderShip.cc
r9829 r9868 42 42 RegisterClass(InvaderShip); 43 43 44 /**45 @brief46 Constructor. Registers and initializes the object.47 */48 44 InvaderShip::InvaderShip(Context* context) : SpaceShip(context) 49 45 { … … 78 74 if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3) 79 75 velocity.x = 0; 80 // this->setVelocity(Vector3(1000 + velocity.y, 0, velocity.x));81 76 pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt; 82 77 } 83 78 79 // shoot! 84 80 if (isFireing) 85 81 ControllableEntity::fire(0); … … 91 87 camera->setPosition(Vector3(-pos.z, -posforeward, 0)); 92 88 camera->setOrientation(Vector3::UNIT_Z, Degree(90)); 93 // orxout() << "asbhajskjasjahg" << pos << endl;94 89 } 95 90 … … 97 92 98 93 // 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;103 94 if(pos.y != 0) 104 95 pos.y = 0; 105 106 96 107 97 setPosition(pos); … … 122 112 lastTime = 0; 123 113 if (getGame()) 124 {125 114 getGame()->levelUp(); 126 // SmartPtr<Invader> game = orxonox_cast<Invader>(getGametype());127 128 }129 //level++130 115 } 131 116 … … 144 129 { 145 130 isFireing = bBoost; 131 // restart if game ended 132 if (getGame()) 133 if (getGame()->bEndGame) 134 getGame()->start(); 146 135 } 147 136 inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 148 137 { 149 138 // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint; 150 151 139 WeakPtr<InvaderEnemy> enemy = orxonox_cast<InvaderEnemy*>(otherObject); 140 // ensure that this gets only called once per enemy. 152 141 if (enemy != NULL && lastEnemy != enemy) 153 142 { 154 143 lastEnemy = enemy; 155 orxout() << "Enemy!!!! " << endl; 144 156 145 removeHealth(20); 157 if (get Health() <= 0)146 if (getGame()) 158 147 { 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(); 166 151 } 167 152 return false;
Note: See TracChangeset
for help on using the changeset viewer.