Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 19, 2014, 4:20:18 PM (10 years ago)
Author:
maxima
Message:
 
Location:
code/branches/towerdefenseHS14
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/towerdefenseHS14/data/levels/templates/enemyTowerdefense.oxt

    r10126 r10132  
    6262          <waypoints>
    6363            <!-- 1,3 10,3 10,11, 13,11 -->
    64             <Model mesh="cube.mesh" scale=10 position="-700,-500, 150" />
    65             <Model mesh="cube.mesh" scale=10 position=" -400,-500, 150" />
    66             <Model  position=" -400, 600, 150" />
    67             <Model mesh="cube.mesh" scale=10 position=" 500, 600, 150" />
    68             <Model mesh="cube.mesh" scale=10 position=" 500, 700, 150" />
     64           
     65            <Model  position="-700,-500, 150" />
     66            <Model  position=" 200,-500, 150" />
     67           
     68            <Model  position=" 200, 300, 150" />
     69            <Model  position=" 500, 300, 150" />
     70          <!--  <Model mesh="cube.mesh" scale=10 position=" 500, 700, 150" /> -->
     71            <Model  position=" 500, 700, 150" />
     72           
    6973          </waypoints>
    7074        </WaypointController>
  • code/branches/towerdefenseHS14/data/levels/towerDefense.oxw

    r10126 r10132  
    7777    <!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /-->
    7878
    79     <TowerDefenseEnemy position="-700,-500, 100" lookat="0,0,0" scale=3 team=1 >
    80       <templates>
    81         <Template link=enemytowerdefense />
    82       </templates>
    83       <controller>
    84         <WaypointController accuracy=60>
    85           <waypoints>
    86             <!-- 1,3 10,3 10,11, 13,11 -->
    87             <Model mesh="cube.mesh" scale=10 position="-700,-500, 150" />
    88             <Model mesh="cube.mesh" scale=10 position=" 200,-500, 150" />
    89             <Model mesh="cube.mesh" scale=10 position=" 200, 300, 150" />
    90             <Model mesh="cube.mesh" scale=10 position=" 500, 300, 150" />
    91             <Model mesh="cube.mesh" scale=10 position=" 500, 700, 150" />
    92           </waypoints>
    93         </WaypointController>
    94       </controller>
    95     </TowerDefenseEnemy>
     79
    9680
    9781
  • code/branches/towerdefenseHS14/src/modules/towerdefense/Tower.cc

    r10091 r10132  
    4040    {
    4141        static int ori;
    42         orxout() << "orientation " << ++ori << endl;
     42        //orxout() << "orientation " << ++ori << endl;
    4343    }
    4444
     
    5858    {
    5959        static int roll;
    60         orxout() << "rotateRoll" << ++roll << endl;
     60        //orxout() << "rotateRoll" << ++roll << endl;
    6161    }
    6262
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc

    r10126 r10132  
    129129        orxout() << "test0" << endl;
    130130
    131 
    132131        Deathmatch::start();
     132
     133        time=0.0;
    133134
    134135/*
     
    143144*/
    144145
    145         orxout() << "test3" << endl;
    146146
    147147        //add some TowerDefenseEnemys
    148148
    149         TDCoordinate* coord1 = new TDCoordinate(1,1);
    150         TDCoordinate* coord2 = new TDCoordinate(1,3);
    151         TDCoordinate* coord3 = new TDCoordinate(10,3);
    152 
    153 
    154         std::vector<TDCoordinate*> path;
    155 
    156 
    157         path.push_back(coord1);
    158 
    159         path.push_back(coord2);
    160 
    161         path.push_back(coord3);
    162 
    163 
    164 
    165         for(int i = 0 ; i < 20 ; ++i)
    166         {
    167                 addTowerDefenseEnemy(path);
    168         }
    169 
    170         orxout() << "test7" << endl;
     149
     150
     151
    171152
    172153        //ChatManager::message("Use the console command addTower x y to add towers");
     
    178159
    179160    void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate*> path){
    180 
    181         orxout() << "test1" << endl;
    182161
    183162        TowerDefenseEnemy* en1 = new TowerDefenseEnemy(this->center_->getContext());
     
    186165        en1->getController();
    187166
    188 
    189         /*en1->setInitialHealth(1000);
    190         en1->setHealth(1000);
    191         en1->setMaxHealth(1000);
    192         en1->setInitialShieldHealth(1000);
    193         en1->setShieldHealth(1000);
    194         en1->setMaxShieldHealth(1000);*/
    195         orxout() << "en1 " << en1->getHealth() << endl;
    196 
    197 
    198         //Model* TowerDefenseEnemymodel = new Model(this->center_->getContext());
    199 
    200         //TowerDefenseEnemymodel->setMeshSource("cube.mesh");
    201 
    202         //TowerDefenseEnemymodel->setPosition(0,0,75);
    203167        en1->setPosition(path.at(0)->get3dcoordinate());
    204168
    205         //TowerDefenseEnemymodel->setScale(10);
    206 
    207 
    208         //en1->attach(TowerDefenseEnemymodel);
    209169
    210170        TowerDefenseEnemyvector.push_back(en1);
    211171
    212         orxout() << "test2" << endl;
    213172
    214173        for(unsigned int i = 0; i < path.size(); ++i)
     
    216175            en1->addWaypoint((path.at(i)));
    217176        }
    218         orxout() << "test6" << endl;
    219 
    220 
    221        /* for (int i = 0; i < TowerDefenseEnemyvector.size(); ++i )
    222                {
    223                 orxout() <<i << " " << TowerDefenseEnemyvector.at(i)->getHealth() << endl;
    224                }
    225 
     177
     178
     179       /*
    226180        WaypointController *newController = new WaypointController(en1->getContext());//
    227181        newController->setAccuracy(3);
     
    321275    {
    322276        SUPER(TowerDefense, tick, dt);
    323 
    324        /* for (int i = 0; i < TowerDefenseEnemyvector.size(); ++i )
    325         {
    326                 orxout() <<i << " " << TowerDefenseEnemyvector.at(i)->getHealth() << endl;
    327         }
    328 */
     277        time +=dt;
     278
     279        TDCoordinate* coord1 = new TDCoordinate(1,1);
     280        std::vector<TDCoordinate*> path;
     281        path.push_back(coord1);
     282
     283            if(time>1 && TowerDefenseEnemyvector.size() < 30)
     284            {
     285                addTowerDefenseEnemy(path);
     286                time = time-1;
     287            }
     288
    329289
    330290    }
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h

    r10123 r10132  
    8585    private:
    8686        TowerDefenseCenterpoint *center_;
     87        float time;
    8788
    8889        /* handles stats */
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseController.cc

    r10091 r10132  
    3333#include "core/XMLPort.h"
    3434#include "worldentities/pawns/Pawn.h"
     35#include "controllers/WaypointController.h"
    3536
    3637namespace orxonox
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc

    r10126 r10132  
    3434    void TowerDefenseEnemy::addWaypoint(TDCoordinate* coord)
    3535    {
    36         orxout() << "test4" << endl;
    3736        this->Waypointsvector_.push_back(coord);
    38         orxout() << "test5" << endl;
    3937    }
     38
     39
     40    void TowerDefenseEnemy::tick(float dt)
     41    {
     42        SUPER(TowerDefenseEnemy, tick, dt);
     43
     44        //ArtificialController* controller = (ArtificialController*)this->getController();
     45        Vector3 ship = this->getRVWorldPosition();
     46        Vector3* endpoint = new Vector3(500, 700, 150);
     47
     48        float distance = ship.distance(*endpoint);
     49
     50        orxout() << "distance" << distance << endl;
     51        if(distance <50){
     52                orxout() << "ENEMY KILLED!!!!" << endl;
     53                this->destroy(); }
     54    }
     55
    4056/*
    4157    void TowerDefenseEnemy::popWaypoint()
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.h

    r10126 r10132  
    2222#include "worldentities/pawns/SpaceShip.h"
    2323#include "util/Output.h"
     24#include "controllers/ArtificialController.h"
    2425
    2526namespace orxonox
     
    3839        //health gibt es unter: health_
    3940
     41        virtual void tick(float dt);
    4042        void addWaypoint(TDCoordinate* coord);
    4143        void popWaypoint();
Note: See TracChangeset for help on using the changeset viewer.