- Timestamp:
- Dec 10, 2014, 3:40:05 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc
r10154 r10166 46 46 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 47 47 this->center_ = 0; 48 /* 49 this->setHUDTemplate("DodgeRaceHUD"); // !!!!!!!!!!!!!!! change later*/48 49 this->setHUDTemplate("DodgeRaceHUD"); 50 50 } 51 51 … … 53 53 { 54 54 bEndGame = false; 55 lives = 3;55 lives = 1; 56 56 level = 1; 57 57 point = 0; … … 59 59 multiplier = 1; 60 60 b_combo = false; 61 counter = 0;61 counter = 5000; 62 62 pattern = 1; 63 63 lastPosition = 0; … … 95 95 counter = counter + (currentPosition - lastPosition); 96 96 lastPosition = currentPosition; 97 98 for(int i=0; i< cubeList.size();i++) 97 point = currentPosition; 98 getPlayer()->speed = 830 - (point / 1000); 99 100 for(uint i=0; i < cubeList.size();i++) 99 101 { 100 102 if(cubeList.at(i)->getPosition().x < currentPosition-3000) … … 108 110 { 109 111 counter = 0; 110 111 112 for(int i = 0; i<6; i++) 112 113 { … … 147 148 return player; 148 149 } 149 /* 150 void DodgeRace::spawnEnemy() 151 { 152 if (getPlayer() == NULL) 153 return; 154 155 for (int i = 0; i < (3*log10(static_cast<double>(level)) + 1); i++) 156 { 157 WeakPtr<DodgeRaceEnemy> newPawn; 158 if (rand() % 42/(1 + level*level) == 0) 159 { 160 newPawn = new DodgeRaceEnemyShooter(this->center_->getContext()); 161 newPawn->addTemplate("enemyinvadershooter"); 162 } 163 else 164 { 165 newPawn = new DodgeRaceEnemy(this->center_->getContext()); 166 newPawn->addTemplate("enemyinvader"); 167 } 168 newPawn->setPlayer(player); 169 newPawn->level = level; 170 // spawn enemy at random points in front of player. 171 newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200)); 172 } 173 } 174 */ 150 175 151 void DodgeRace::costLife() 176 152 { 177 orxout() << "CostLife" << endl; 178 endGameTimer.setTimer(3.0f, false, createExecutor(createFunctor(&DodgeRace::end, this))); 179 180 multiplier = 1; 153 //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&DodgeRace::end, this))); 154 lives = 0; 181 155 }; 182 156 … … 193 167 void DodgeRace::start() 194 168 { 195 orxout() << "start function called." << endl;169 orxout() << "start" << endl; 196 170 init(); 171 for(uint i=0; i< cubeList.size();i++) 172 { 173 cubeList.at(i)->destroy(); 174 cubeList.erase(cubeList.begin()+i); 175 176 } 177 cubeList.clear(); 178 // Set variable to temporarily force the player to spawn. 179 this->bForceSpawn_ = false; 180 181 if (this->center_ == NULL) // abandon mission! 182 { 183 orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl; 184 GSLevel::startMainMenu(); 185 return; 186 } 187 // Call start for the parent class. 188 Deathmatch::start(); 189 } 190 191 void DodgeRace::playerPreSpawn(PlayerInfo* player) 192 { 193 if(lives <= 0) 194 { 195 this->end(); 196 } 197 198 // Reset all the cubes 199 /* 200 orxout() << "prespawn" << endl; 201 init(); 197 202 for(int i=0; i< cubeList.size();i++) 198 203 { 199 204 cubeList.at(i)->destroy(); 200 205 cubeList.erase(cubeList.begin()+i); 201 202 206 } 203 cubeList.clear(); 204 // Set variable to temporarily force the player to spawn. 205 this->bForceSpawn_ = true; 206 207 if (this->center_ == NULL) // abandon mission! 208 { 209 orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl; 210 GSLevel::startMainMenu(); 211 return; 212 } 213 // Call start for the parent class. 214 Deathmatch::start(); 215 } 207 cubeList.clear(); 208 lives = 1; 209 point = 0; 210 lastPosition = 0; 211 */ 212 } 213 216 214 void DodgeRace::addPoints(int numPoints) 217 215 {
Note: See TracChangeset
for help on using the changeset viewer.