Changeset 10152 for code/branches/surfaceraceHS14/src
- Timestamp:
- Dec 3, 2014, 5:18:24 PM (10 years ago)
- Location:
- code/branches/surfaceraceHS14/src/modules/dodgerace2
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/surfaceraceHS14/src/modules/dodgerace2/CMakeLists.txt
r10118 r10152 3 3 DodgeRaceCenterPoint.cc 4 4 DodgeRaceShip.cc 5 DodgeRaceCube.cc 5 6 DodgeRaceHUDinfo.cc 6 7 ) -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc
r10135 r10152 34 34 #include "DodgeRace.h" 35 35 #include "DodgeRaceShip.h" // Necessary for getPlayer function. Do NOT include this in Header! 36 #include "DodgeRaceCube.h" 36 37 37 38 namespace orxonox … … 59 60 b_combo = false; 60 61 counter = 0; 62 pattern = 1; 61 63 lastPosition = 0; 62 64 // spawn enemy every 3.5 seconds … … 94 96 lastPosition = currentPosition; 95 97 96 if(counter >= 5000) 98 for(int i=0; i< cubeList.size();i++) 99 { 100 if(cubeList.at(i)->getPosition().x < currentPosition-3000) 101 { 102 cubeList.at(i)->destroy(); 103 cubeList.erase(cubeList.begin()+i); 104 } 105 } 106 107 if(counter >= 3000) 97 108 { 98 109 counter = 0; 99 110 100 WeakPtr<StaticEntity> stentity = new StaticEntity(this->center_->getContext()); //this->center_->getContext() 101 stentity->addTemplate("DodgeRaceCube01"); 102 103 stentity->setPosition(getPlayer()->getWorldPosition() + Vector3(5000, 0, 0)); 104 //stentity->setScale3D(50,50,50); 111 for(int i = 0; i<6; i++) 112 { 113 WeakPtr<DodgeRaceCube> cube = new DodgeRaceCube(this->center_->getContext()); 114 cubeList.push_back(cube); 115 switch(pattern) 116 { 117 case 1: cube->addTemplate("DodgeRaceCube01"); 118 break; 119 case 2: cube->addTemplate("DodgeRaceCube02"); 120 break; 121 122 } 123 124 cube->setPosition(getPlayer()->getWorldPosition() + Vector3(5000, 0, -3600 + (i*1200))); 125 //stEntity->setScale3D(50,50,50); 126 } 127 128 129 pattern %= 2; 130 pattern ++; 131 105 132 } 133 106 134 } 107 135 SUPER(DodgeRace, tick, dt); … … 166 194 void DodgeRace::start() 167 195 { 196 orxout() << "start function called." << endl; 168 197 init(); 198 for(int i=0; i< cubeList.size();i++) 199 { 200 cubeList.at(i)->destroy(); 201 cubeList.erase(cubeList.begin()+i); 202 203 } 204 cubeList.clear(); 169 205 // Set variable to temporarily force the player to spawn. 170 206 this->bForceSpawn_ = true; -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.h
r10135 r10152 51 51 #include "gamestates/GSLevel.h" 52 52 #include "chat/ChatManager.h" 53 #include <vector> 53 54 54 55 // ! HACK … … 96 97 int multiplier; 97 98 int counter; 99 int pattern; 98 100 int currentPosition; 99 101 int lastPosition; … … 102 104 WeakPtr<DodgeRaceShip> getPlayer(); 103 105 WeakPtr<DodgeRaceShip> player; 106 std::vector<DodgeRaceCube*> cubeList; 104 107 void toggleShowLevel(){bShowLevel = !bShowLevel;} 105 108 void addPoints(int numPoints); -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRacePrereqs.h
r10118 r10152 71 71 class DodgeRaceCenterPoint; 72 72 class DodgeRaceShip; 73 class DodgeRaceCube; 73 74 //class DodgeRaceEnemy; 74 75 //class DodgeRaceEnemyShooter; -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.cc
r10135 r10152 75 75 velocity.y = 0; 76 76 // restart if game ended 77 /* 77 78 if (getGame()) 78 79 if (getGame()->bEndGame) … … 80 81 getGame()->start(); 81 82 return; 82 } 83 }*/ 83 84 } 84 85 /*
Note: See TracChangeset
for help on using the changeset viewer.