- Timestamp:
- Nov 25, 2013, 5:35:30 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/invaders/src/modules/invader/InvaderShip.cc
r9793 r9828 70 70 { 71 71 float dist_y = velocity.y * dt; 72 float dist_x = velocity.x * dt; 72 73 if(dist_y + posforeward > -42*3 && dist_y + posforeward < 42*6) 73 74 posforeward += dist_y; 74 75 else 75 76 velocity.y = 0; 77 if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3) 78 velocity.x = 0; 76 79 // this->setVelocity(Vector3(1000 + velocity.y, 0, velocity.x)); 77 80 pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt; … … 93 96 94 97 // 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; 99 102 if(pos.y != 0) 100 103 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)110 104 111 105 … … 114 108 115 109 // Level up! 116 if (pos.x > 30000)110 if (pos.x > 42000) 117 111 { 118 112 updateLevel(); 119 setPosition(Vector3(0, 0, 0)); // pos - Vector3(30000, 0, 0)113 setPosition(Vector3(0, 0, pos.z)); // pos - Vector3(30000, 0, 0) 120 114 } 121 115 … … 144 138 isFireing = bBoost; 145 139 } 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 } 146 159 }
Note: See TracChangeset
for help on using the changeset viewer.