- Timestamp:
- Dec 3, 2014, 5:18:24 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.