Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2014, 1:05:08 PM (9 years ago)
Author:
maxima
Message:

final version for presentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc

    r10159 r10172  
    1212*/
    1313#include "TowerDefenseEnemy.h"
    14 
    1514#include "core/CoreIncludes.h"
    1615//#include "core/XMLPort.h"
     
    2928
    3029        this->setCollisionType(WorldEntity::Dynamic);
     30        //needed to keep track of the PlayerStats coded in TowerDefense.h
    3131        this->td = orxonox_cast<TowerDefense*>(this->getGametype().get());
    32         once_ = false;
    3332
    3433    }
    35 
    36     TowerDefenseEnemy::~TowerDefenseEnemy(){this->td->addCredit(20);}
     34    //add credit if enemy is destroyed
     35    TowerDefenseEnemy::~TowerDefenseEnemy(){
     36                this->td->addCredit(1);
     37    }
    3738
    3839    void TowerDefenseEnemy::addWaypoint(TDCoordinate* coord)
     
    4546    {
    4647        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         }
    6648    }
    6749
Note: See TracChangeset for help on using the changeset viewer.