- Timestamp:
- Dec 11, 2014, 1:05:08 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc
r10159 r10172 12 12 */ 13 13 #include "TowerDefenseEnemy.h" 14 15 14 #include "core/CoreIncludes.h" 16 15 //#include "core/XMLPort.h" … … 29 28 30 29 this->setCollisionType(WorldEntity::Dynamic); 30 //needed to keep track of the PlayerStats coded in TowerDefense.h 31 31 this->td = orxonox_cast<TowerDefense*>(this->getGametype().get()); 32 once_ = false;33 32 34 33 } 35 36 TowerDefenseEnemy::~TowerDefenseEnemy(){this->td->addCredit(20);} 34 //add credit if enemy is destroyed 35 TowerDefenseEnemy::~TowerDefenseEnemy(){ 36 this->td->addCredit(1); 37 } 37 38 38 39 void TowerDefenseEnemy::addWaypoint(TDCoordinate* coord) … … 45 46 { 46 47 SUPER(TowerDefenseEnemy, tick, dt); 47 48 //ArtificialController* controller = (ArtificialController*)this->getController();49 Vector3 ship = this->getRVWorldPosition();50 Vector3* endpoint = new Vector3(500, 700, 150);51 52 float distance = ship.distance(*endpoint);53 54 //orxout() << "distance" << distance << endl;55 if(distance < 50 && once_ == false){56 this->td->reduceLifes(1);57 once_=true;58 orxout() << "ENEMY KILLED!!!!" << endl;59 this->td->buyTower(20);60 if (this->td->getLifes()==0)61 {62 this->td->end();63 }64 65 }66 48 } 67 49
Note: See TracChangeset
for help on using the changeset viewer.