Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10109


Ignore:
Timestamp:
Nov 5, 2014, 3:59:18 PM (10 years ago)
Author:
erbj
Message:

EnemyAdd implementierung

Location:
code/branches/towerdefenseHS14/src/modules/towerdefense
Files:
2 added
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/towerdefenseHS14/src/modules/towerdefense/CMakeLists.txt

    r10106 r10109  
    77  TowerDefensePlayerStats.cc
    88  TDCoordinate.cc
    9   Enemy.cc
     9  TowerDefenseEnemy.cc
    1010
    1111)
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc

    r10105 r10109  
    8686#include "graphics/Model.h"
    8787#include "infos/PlayerInfo.h"
    88 
    8988#include "chat/ChatManager.h"
    9089#include "core/CoreIncludes.h"
     
    128127    void TowerDefense::start()
    129128    {
     129        orxout() << "test0" << endl;
     130
    130131        Deathmatch::start();
    131132
     
    139140        }
    140141
    141         ChatManager::message("Use the console command addTower x y to add towers");
     142        orxout() << "test3" << endl;
     143
     144        //add some TowerDefenseEnemys
     145
     146        TDCoordinate* coord1 = new TDCoordinate(1,1);
     147        /*TDCoordinate* coord2 = new TDCoordinate(10,10);
     148        TDCoordinate* coord3 = new TDCoordinate(1,2);*/
     149        std::vector<TDCoordinate> path;
     150        path.push_back(*coord1);
     151        /*path.push_back(*coord2);
     152        path.push_back(*coord3);*/
     153
     154        for(int i = 0 ; i <4 ; ++i)
     155        {
     156                addTowerDefenseEnemy(path);
     157        }
     158
     159        //ChatManager::message("Use the console command addTower x y to add towers");
    142160
    143161        //TODO: let the player control his controllable entity && TODO: create a new ControllableEntity for the player
    144162    }
    145163
    146     void TowerDefense::addEnemy(){}
     164    void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate> path){
     165
     166        orxout() << "test1" << endl;
     167
     168        TowerDefenseEnemy* en1 = new TowerDefenseEnemy(this->center_->getContext());
     169        // Model* TowerDefenseEnemymodel = new Model(this->center_->getContext());
     170        //TowerDefenseEnemymodel->setMeshSource("crate.mesh");
     171        //TowerDefenseEnemymodel->setPosition(0,0,0);
     172        en1->setPosition(path.at(0).get3dcoordinate());
     173        //TowerDefenseEnemymodel->setScale(0.2);
     174
     175        //en1->attach(TowerDefenseEnemymodel);
     176
     177        //TowerDefenseEnemyvector.push_back(en1);
     178
     179        orxout() << "test2" << endl;
     180
     181        /*for(unsigned int i = 0; i < path.size(); ++i)
     182        {
     183            en1->addWaypoint(path.at(i));
     184        }*/
     185
     186        orxout() << "test6" << endl;
     187
     188        /*WaypointController *newController = new WaypointController(en1);
     189        newController->setAccuracy(3);
     190
     191        for(int i =0; i < path.size(); ++i)
     192        {
     193
     194            Model *wayPoint = new Model(newController);
     195            wayPoint->setMeshSource("crate.mesh");
     196            wayPoint->setPosition(path.at(i).get3dcoordinate());
     197            wayPoint->setScale(0.2);
     198
     199            newController->addWaypoint(wayPoint);
     200
     201        }*/
     202
     203    }
    147204
    148205
     
    158215    void TowerDefense::addTower(int x, int y)
    159216    {
    160         const TowerCost towerCost = TDDefaultTowerCost;
     217        /*const TowerCost towerCost = TDDefaultTowerCost;
    161218
    162219        if (!this->hasEnoughCreditForTower(towerCost))
     
    172229        }
    173230
    174         /*
     231
    175232        unsigned int width = this->center_->getWidth();
    176233        unsigned int height = this->center_->getHeight();
    177         */
     234
    178235
    179236        int tileScale = (int) this->center_->getTileScale();
     
    204261
    205262        newTower->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
    206         newTower->setGame(this);
     263        newTower->setGame(this);*/
    207264    }
    208265
     
    227284    void TowerDefense::tick(float dt)
    228285    {
    229         SUPER(TowerDefense, tick, dt);
     286        //SUPER(TowerDefense, tick, dt);
    230287    }
    231288
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h

    r10105 r10109  
    4040#include "towerdefense/TowerDefensePrereqs.h"
    4141#include "gametypes/Deathmatch.h"
     42#include "TowerDefenseEnemy.h"
     43#include "util/Output.h"
     44
    4245
    4346 #include "TowerDefensePlayerStats.h"
     
    5154        virtual ~TowerDefense();
    5255
    53         void addEnemy();
     56        std::vector<TowerDefenseEnemy*> TowerDefenseEnemyvector;
     57
     58        void addTowerDefenseEnemy(std::vector<TDCoordinate> path);
    5459        virtual void start(); //<! The function is called when the gametype starts
    5560        virtual void end();
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePrereqs.h

    r10091 r10109  
    7070    class TowerDefenseHUDController;
    7171    class TowerDefensePlayerStats;
     72    class TowerDefenseEnemy;
     73    class TDCoordinate;
    7274    class TowerTurret;
    7375}
Note: See TracChangeset for help on using the changeset viewer.