Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 26, 2014, 5:14:33 PM (10 years ago)
Author:
maxima
Message:

hzilly. Alle files zusammengefuegt.

Location:
code/branches/towerdefenseHS14
Files:
2 added
7 edited

Legend:

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

    r10140 r10142  
    11<Template name=tower>
    2   <Tower
     2  <TowerDefenseTower
    33
    44
     
    99
    1010   collisionType     = "dynamic"
    11    team = 0
     11   team = 2
    1212
    1313
     
    2020        </WaypointPatrolController>
    2121    </controller>
     22   
    2223
    2324
    2425    <attached>
    2526        <Model position="0,0,0" scale=45 mesh="Tower.mesh" />
     27       
     28        <Turret position="0,0,-100" collisionType="dynamic" angularDamping=0.999999 mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=2000 minAttackRadius=30>
     29       
     30                <collisionShapes>
     31                        <SphereCollisionShape radius="10"   position = "0,0,0"/>
     32                </collisionShapes>
     33                <controller>
     34                        <TurretController/>
     35                </controller>
     36                <?lua
     37                        include("../includes/weaponSettingsTurret.oxi")
     38                ?>
     39        </Turret>
    2640    </attached>
    2741
     
    3347  include("../includes/towerWeaponSettings.oxi")
    3448?>
    35   </Tower>
     49  </TowerDefenseTower>
    3650</Template>
    3751
  • code/branches/towerdefenseHS14/src/modules/towerdefense/CMakeLists.txt

    r10109 r10142  
    11SET_SOURCE_FILES(TOWERDEFENSE_SRC_FILES
    22  TowerDefense.cc
    3   Tower.cc
     3  TowerDefenseTower.cc
    44  TowerTurret.cc
    55  TowerDefenseCenterpoint.cc
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc

    r10141 r10142  
    7575
    7676#include "TowerDefense.h"
    77 //#include "Tower.h"
     77#include "TowerDefenseTower.h"
    7878#include "TowerTurret.h"
    7979#include "TowerDefenseCenterpoint.h"
     
    130130
    131131        Deathmatch::start();
     132
     133// Waypoints: [1,3] [10,3] [10,11] [13,11]
     134        for (int i=0; i < 16 ; i++){
     135                for (int j = 0; j< 16 ; j++){
     136                        towermatrix[i][j] = false;
     137                }
     138        }
     139        for (int k=0; k<3; k++)
     140                towermatrix[1][k]=true;
     141        for (int l=1; l<11; l++)
     142                towermatrix[l][3]=true;
     143        for (int m=3; m<12; m++)
     144                towermatrix[10][m]=true;
     145        for (int n=10; n<14; n++)
     146                towermatrix[n][11]=true;
     147        for (int o=13; o<16; o++)
     148                towermatrix[13][o]=true;
     149
     150
    132151        credits = 5000;
    133152        life = 20;
     
    135154        time=0.0;
    136155
    137 /*
    138         const int kInitialTowerCount = 3;
     156        const int kInitialTowerCount = 3;
    139157
    140158        for (int i = 0; i < kInitialTowerCount; i++)
    141159        {
    142                 //{{3,2}, {8,5}, {12,10}}; old coordinates
    143             TDCoordinate* coordinate = new TDCoordinate(i,(i*2));
    144             addTower(coordinate->x, coordinate->y);
    145         }
    146 */
     160            addTower(i+4,(i+5));
     161        }
     162
    147163
    148164
     
    221237
    222238    void TowerDefense::addTower(int x, int y)
    223     {/*
     239    {
    224240        const TowerCost towerCost = TDDefaultTowerCost;
    225241
     
    230246        }
    231247
    232         if (this->towerExists(x,y))
    233         {
    234             orxout() << "tower exists!!" << endl;
     248        if (towermatrix [x][y]==true)
     249        {
     250            orxout() << "not possible to put tower here!!" << endl;
    235251            return;
    236252        }
     
    252268        orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl;
    253269
    254         // Add tower to coordinatesStack
    255         TDCoordinate newTowerCoordinates;
    256         newTowerCoordinates.x=x;
    257         newTowerCoordinates.y=y;
    258 
    259 
    260         addedTowersCoordinates_.push_back(newTowerCoordinates);
    261 
    262         // Reduce credit
     270       
     271
     272       //Reduce credit
    263273        this->stats_->buyTower(towerCost);
    264274
    265         // Create tower
    266         TowerTurret* newTower = new TowerTurret(this->center_->getContext());
    267         newTower->addTemplate(this->center_->getTowerTemplate());
    268 
    269         newTower->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
    270         newTower->setGame(this);*/
     275        orxout() << "Credit: " << this->stats_->getCredit() << endl;
     276
     277  //    Create tower
     278        TowerDefenseTower* towernew = new TowerDefenseTower(this->center_->getContext());
     279        towernew->addTemplate("tower");
     280        towernew->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
     281        towernew->setGame(this);
     282
     283        towermatrix[x][y]=true;
    271284    }
    272285
     
    276289    }
    277290
    278     bool TowerDefense::towerExists(int x, int y)
    279     {
    280         for(std::vector<TDCoordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it)
    281         {
    282             TDCoordinate currentCoordinates = (TDCoordinate) (*it);
    283             if (currentCoordinates.x == x && currentCoordinates.y == y)
    284                 return true;
    285         }
    286 
    287         return false;
    288     }
    289 
    290 
     291 
    291292    void TowerDefense::tick(float dt)
    292293    {
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h

    r10141 r10142  
    5555
    5656        std::vector<TowerDefenseEnemy*> TowerDefenseEnemyvector;
    57 
     57        bool towermatrix[16][16];
    5858        void addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr);
    5959        virtual void start(); //<! The function is called when the gametype starts
     
    9494        bool hasEnoughCreditForTower(TowerCost towerCost);
    9595
    96         bool towerExists(int x, int y);
    97 
    98 
    99         std::vector<TDCoordinate> addedTowersCoordinates_;
    10096        std::vector<TowerTurret*> towers_;
    10197    };
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc

    r10140 r10142  
    4848        float distance = ship.distance(*endpoint);
    4949
    50         orxout() << "distance" << distance << endl;
     50        //orxout() << "distance" << distance << endl;
    5151        if(distance <50){
    52                 orxout() << "ENEMY KILLED!!!!" << endl;
     52        //      orxout() << "ENEMY KILLED!!!!" << endl;
    5353                this->destroy(); }
    5454    }
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.h

    r9272 r10142  
    4444    typedef enum _TowerCosts {
    4545        // Set to 0 for debug...
    46         TDDefaultTowerCost = 0
     46        TDDefaultTowerCost = 20
    4747    } TowerCost;
    4848
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePrereqs.h

    r10109 r10142  
    6666{
    6767    class TowerDefense;
    68     //class Tower;
     68    class TowerDefenseTower;
    6969    class TowerDefenseCenterpoint;
    7070    class TowerDefenseHUDController;
Note: See TracChangeset for help on using the changeset viewer.