Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 29, 2012, 11:17:38 AM (13 years ago)
Author:
mentzerf
Message:

+ 'addTower' now adds a "tower" (actually a green cube) at 0,0

Location:
code/branches/newlevel2012
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/newlevel2012/data/levels/towerDefense.oxw

    r9134 r9137  
    4848  <Tower>
    4949    <attached>
    50       <Model position="15,0,0" mesh="crate.mesh" scale=1 />
     50      <Model position="15,0,0" mesh="cube_green.mesh" scale=1 />
    5151    </attached>
    5252  </Tower>
  • code/branches/newlevel2012/src/modules/towerdefense/Tower.h

    r9135 r9137  
    2424                virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
    2525               
    26                
    27                
     26                void setGame(TowerDefense* towerdefense)
     27                { assert(towerdefense); game_ = towerdefense; }
     28        private:
     29                TowerDefense* game_;
    2830    };
    2931}
  • code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc

    r9136 r9137  
    5656
    5757#include "TowerDefense.h"
     58#include "Tower.h"
     59#include "TowerDefenseCenterpoint.h"
     60
    5861#include "worldentities/SpawnPoint.h"
    5962#include "worldentities/pawns/Pawn.h"
     
    110113        void TowerDefense::addTower(int x, int y)
    111114        {
    112                 orxout()<< "Should add tower at (" << x << "," << y << ")" << endl;
    113                
    114115                if (x > 16 || y > 16)
    115116                {
     
    118119                }
    119120               
     121                orxout()<< "Should add tower at (" << x << "," << y << ")" << endl;
     122               
     123                Tower* newTower = new Tower(this->center_);
     124                newTower->addTemplate(this->center_->getTowerTemplate());
     125               
     126                this->center_->attach(newTower);
     127               
     128                newTower->setPosition(0,0,0);
     129                newTower->setGame(this);
    120130               
    121131               
Note: See TracChangeset for help on using the changeset viewer.