Changeset 9245 for code/branches/presentation2012/src/modules
- Timestamp:
- May 24, 2012, 10:07:43 PM (12 years ago)
- Location:
- code/branches/presentation2012
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2012
- Property svn:mergeinfo changed
/code/branches/newlevel2012 merged: 9236
- Property svn:mergeinfo changed
-
code/branches/presentation2012/src/modules/towerdefense/Tower.cc
r9229 r9245 22 22 Constructor. Registers and initializes the object. 23 23 */ 24 Tower::Tower(BaseObject* creator) : SpaceShip(creator)24 Tower::Tower(BaseObject* creator) : Pawn(creator) 25 25 { 26 26 RegisterObject(Tower); … … 36 36 */ 37 37 } 38 39 void Tower::setOrientation(const Quaternion& orientation) 40 { 41 static int ori; 42 orxout() << "orientation " << ++ori << endl; 43 } 44 45 void Tower::rotateYaw(const Vector2& value) 46 { 47 static int yaw; 48 orxout() << "rotateYaw " << ++yaw << endl; 49 } 50 51 void Tower::rotatePitch(const Vector2& value) 52 { 53 static int pitch; 54 orxout() << "rotatePitch " << ++pitch << endl; 55 } 56 57 void Tower::rotateRoll(const Vector2& value) 58 { 59 static int roll; 60 orxout() << "rotateRoll" << ++roll << endl; 61 } 62 38 63 // This function is called whenever a player presses the up or the down key. 39 64 // You have to implement what happens when the up or the down key is pressed. … … 55 80 A vector whose first component is the angle by which to rotate. 56 81 */ 82 /* 57 83 void Tower::moveFrontBack(const Vector2& value) 58 84 { 59 85 //orxout() << "frontBack.x: " << value.x << endl; 60 86 } 87 */ 61 88 62 89 /** … … 66 93 A vector whose first component is the direction in which we want to steer the stone. 67 94 */ 95 /* 68 96 void Tower::moveRightLeft(const Vector2& value) 69 97 { 70 98 //orxout() << "rightLeft.x: " << value.x << endl; 71 /*99 72 100 if(!this->delay_) 73 101 { … … 80 108 this->delay_ = true; 81 109 this->delayTimer_.startTimer(); 82 } 83 */ 110 } 84 111 } 112 */ 85 113 } -
code/branches/presentation2012/src/modules/towerdefense/Tower.h
r9229 r9245 20 20 #include "towerdefense/TowerDefensePrereqs.h" 21 21 #include "worldentities/pawns/SpaceShip.h" 22 22 23 23 24 namespace orxonox 24 25 { 25 class _OrxonoxExport Tower : public SpaceShip26 class _OrxonoxExport Tower : public Pawn 26 27 { 27 28 public: … … 29 30 virtual ~Tower() {}; 30 31 32 // Maybe later override these to move towers with cursor keys 33 /* 31 34 virtual void moveFrontBack(const Vector2& value); 32 35 virtual void moveRightLeft(const Vector2& value); 36 */ 37 38 // Overriding these to stop towers from spasing out 39 void setOrientation(const Quaternion& orientation); 40 virtual void rotateYaw(const Vector2& value); 41 virtual void rotatePitch(const Vector2& value); 42 virtual void rotateRoll(const Vector2& value); 33 43 34 44 void setGame(TowerDefense* towerdefense) -
code/branches/presentation2012/src/modules/towerdefense/TowerDefense.cc
r9229 r9245 105 105 /* Temporary hack to allow the player to add towers */ 106 106 this->dedicatedAddTower_ = createConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) ); 107 108 // Quick hack to test waypoints109 createConsoleCommand( "aw", createExecutor( createFunctor(&TowerDefense::addWaypointsAndFirstEnemy, this) ) );110 107 } 111 108 … … 131 128 Deathmatch::start(); 132 129 133 orxout() << "Adding towers for debug..." << endl; 134 135 // Mark corners 136 addTower(0,15); addTower(15,0); 137 138 // Mark diagonal line 139 for (int i = 0 ; i <= 15; i++) 140 addTower(i,i); 141 142 orxout() << "Done" << endl; 130 const int kInitialTowerCount = 3; 131 Coordinate initialTowerCoordinates[kInitialTowerCount] = {{3,2}, {8,5}, {12,10}}; 132 133 for (int i = 0; i < kInitialTowerCount; i++) 134 { 135 Coordinate coordinate = initialTowerCoordinates[i]; 136 addTower(coordinate.x, coordinate.y); 137 } 143 138 144 139 ChatManager::message("Use the console command addTower x y to add towers"); 145 140 146 141 //TODO: let the player control his controllable entity && TODO: create a new ControllableEntity for the player 147 148 142 } 149 143 … … 198 192 newTower->addTemplate(this->center_->getTowerTemplate()); 199 193 200 //this->center_->attach(newTower); 201 202 newTower->setPosition((x-8) * tileScale, (y-8) * tileScale, 100); 194 newTower->setPosition((x-8) * tileScale, (y-8) * tileScale, 75); 203 195 newTower->setGame(this); 204 //TODO: Save the Tower in a Vector. I would suggest std::vector< std::vector<Tower*> > towers_ as a protected member variable;205 206 // TODO: create Tower mesh207 // TODO: load Tower mesh208 196 } 209 197 … … 229 217 { 230 218 SUPER(TowerDefense, tick, dt); 231 232 static int test = 0;233 if (++test == 10)234 {235 orxout()<< "10th tick." <<endl;236 /*237 for (std::set<SpawnPoint*>::iterator it = this->spawnpoints_.begin(); it != this->spawnpoints_.end(); it++)238 {239 orxout() << "checking spawnpoint with name " << (*it)->getSpawnClass()->getName() << endl;240 }241 */242 243 //addWaypointsAndFirstEnemy();244 245 }246 219 } 247 220 … … 249 222 250 223 // THE PROBLEM: WaypointController's getControllableEntity() returns null, so it won't track. How do we get the controlableEntity to NOT BE NULL??? 251 224 /* 252 225 void TowerDefense::addWaypointsAndFirstEnemy() 253 226 { … … 283 256 // this->center_->attach(newShip); 284 257 } 285 258 */ 286 259 /* 287 260 void TowerDefense::playerEntered(PlayerInfo* player) -
code/branches/presentation2012/src/modules/towerdefense/TowerDefense.h
r9229 r9245 78 78 79 79 private: 80 // WeakPtr<TowerDefenseCenterpoint> center_;81 80 TowerDefenseCenterpoint *center_; 82 81 … … 92 91 } Coordinate; 93 92 94 95 96 93 std::vector<Coordinate> addedTowersCoordinates_; 97 94 std::vector<Tower*> towers_; 98 99 void addWaypointsAndFirstEnemy();100 95 }; 101 96 } -
code/branches/presentation2012/src/modules/towerdefense/TowerDefensePlayerStats.h
r9229 r9245 43 43 { 44 44 typedef enum _TowerCosts { 45 TDDefaultTowerCost = 200 45 // Set to 0 for debug... 46 TDDefaultTowerCost = 0 46 47 } TowerCost; 47 48
Note: See TracChangeset
for help on using the changeset viewer.