Changeset 11334 for code/branches/SpaceRace_HS16/src/modules
- Timestamp:
- Dec 12, 2016, 3:45:36 PM (8 years ago)
- Location:
- code/branches/SpaceRace_HS16/src/modules/gametypes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/SpaceRace_HS16/src/modules/gametypes/CMakeLists.txt
r10624 r11334 3 3 RaceCheckPoint.cc 4 4 SpaceRaceManager.cc 5 OldSpaceRace.cc 6 OldRaceCheckPoint.cc 5 7 6 SpaceRaceBot.cc 8 7 SpaceRaceController.cc -
code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc
r11327 r11334 24 24 * Co-authors: 25 25 * Celine Egger 26 Berkay Berabi 27 Louis Meile 26 28 * 27 29 */ 30 31 /* 32 Todo: 33 - improve AI (SpaceRaceController): 34 i) so far bots arent able to evade obstacles. fix that! 35 ii) bots should be able to use pickups 36 - game crashes when bot wins the game 37 - bots rotate while waiting for the countdown to end. make it stop! 38 - add elements to level file to make it even more fun to play. be creative! 39 */ 40 28 41 29 42 #include "SpaceRace.h" … … 63 76 RegisterObject(SpaceRace); 64 77 65 this->botclass_ = Class(SpaceRaceBot); //ClassByString("")78 this->botclass_ = Class(SpaceRaceBot); //ClassByString("") 66 79 this->cantMove_ = false; 67 80 this->bTimeIsUp_ = false; 68 81 this->setConfigValues(); 69 82 70 // this->numberOfBots_ = 1; // quick fix: don't allow default-bots to enter the race 71 // remove this line, if a raceBot has been created. 83 this->numberOfBots_ = 5; // quick fix: don't allow default-bots to enter the race 72 84 } 73 85 … … 78 90 } 79 91 92 // define spawn positions of the 5 bots 80 93 void SpaceRace::start() 81 94 { 82 95 83 84 /* std::vector<int> spawnpositions;85 86 spawnpositions.push_back(200);87 spawnpositions.push_back(0);88 spawnpositions.push_back(100);89 90 spawnpositions.push_back(200);91 spawnpositions.push_back(200);92 spawnpositions.push_back(0);93 94 spawnpositions.push_back(200);95 spawnpositions.push_back(0);96 spawnpositions.push_back(0);97 98 spawnpositions.push_back(100);99 spawnpositions.push_back(0);100 spawnpositions.push_back(0);101 102 spawnpositions.push_back(0);103 spawnpositions.push_back(100);104 spawnpositions.push_back(0);105 */106 96 int startpos[15]; 107 97 … … 126 116 startpos[14] =80; 127 117 128 /*startpos[15] =129 startpos[0] =130 startpos[0] =131 startpos[0] =132 startpos[0] =133 startpos[0] =*/134 118 135 119 … … 140 124 this->spawnPlayersIfRequested(); 141 125 this->cantMove_ = true; 142 126 //bots unable to move while countdown is running 143 127 for (Engine* engine : ObjectList<Engine>()){ 144 128 engine->setActive(false); … … 146 130 147 131 } 148 132 //append spawn positions to bots 149 133 int a,b,c; 150 134 a=0; … … 163 147 164 148 165 std::string message(" BE FAST BE FIRST");149 std::string message("Use headphones to hear the countdown!"); 166 150 this->getGametypeInfo()->sendAnnounceMessage(message); 167 151 ChatManager::message(message); 168 152 153 //after 11 s, countdownFinished is called to activate bots` engines 169 154 Timer* countdownTimer = new Timer(); 170 155 countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this))); … … 184 169 { 185 170 message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n" 186 + "You didn't reach the check point before the time limit. Youlose!";171 + "You lose!"; 187 172 } 188 173 else … … 203 188 { 204 189 SUPER(SpaceRace,tick,dt); 205 206 207 208 // spawns the players when the countdown starts, but deactivates their engines209 /* if (this->isStartCountdownRunning() && !this->cantMove_)210 {211 this->spawnPlayersIfRequested();212 this->cantMove_ = true;213 214 for (Engine* engine : ObjectList<Engine>())215 engine->setActive(false);216 }*/217 218 219 //gtinfo_->setStartCountdown(50.0);220 221 222 223 224 225 226 227 228 229 // activate the engines when the countdown ends230 /* if (!this->isStartCountdownRunning() && this->cantMove_)231 {232 for (Engine* engine : ObjectList<Engine>())233 engine->setActive(true);234 235 this->cantMove_= false;236 237 238 239 std::string message = "RACE STARTED!";240 this->getGametypeInfo()->sendAnnounceMessage(message);241 ChatManager::message(message);242 }*/243 244 190 } 245 191 … … 289 235 for (unsigned int i = 1; i <= amount; ++i){ 290 236 this->botclass_.fabricate(this->getContext()); 291 //SpaceRaceBot* bot = new SpaceRaceBot(this->getContext()); 292 //bot->setPosition(-i*150,0,-i*100); 293 } 294 295 296 297 298 } 299 300 301 302 303 304 237 } 238 } 239 240 241 //set bot configurations 305 242 bool SpaceRace::allowPawnHit(Pawn* victim, Pawn* originator) 306 243 { -
code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc
r11312 r11334 57 57 "Dr. Julius No", 58 58 "Berkay Berabi", 59 "Louis Meile" 60 61 "Abradolf Lincler" 59 "Louis Meile" 60 "Yo mama" 62 61 }; 63 62 static std::vector<std::string> defaultnames(names, names + sizeof(names) / sizeof(std::string));
Note: See TracChangeset
for help on using the changeset viewer.