Changeset 11554 for code/branches/FlappyOrx_HS17/src
- Timestamp:
- Nov 13, 2017, 3:44:45 PM (7 years ago)
- Location:
- code/branches/FlappyOrx_HS17/src/modules/flappyorx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
r11537 r11554 68 68 multiplier = 1; 69 69 b_combo = false; 70 this->spawnDistance= 300;70 this->spawnDistance=200; 71 71 this->tubeOffsetX=500; 72 72 this->setHUDTemplate("FlappyOrxHUD"); … … 75 75 void FlappyOrx::updatePlayerPos(int x){ 76 76 77 if(this->tubes.size()==0||x-this->tubes.back()-tubeOffsetX>spawnDistance){ 77 if(this->tubes.size()==0||x-tubes.back()+tubeOffsetX>spawnDistance){ 78 orxout()<<"true: "; 78 79 spawnTube(); 79 80 this->tubes.push(x+tubeOffsetX); 80 81 } 82 else{ 83 orxout()<<"false:"; 84 } 85 orxout()<<"x("<<x<<")- tubes.back()("<<tubes.back()<<") + tubeOffsetX("<<tubeOffsetX<<") > spawnDistance("<<spawnDistance<<")"<<std::endl; 81 86 if(this->tubes.size()!=0&&x>this->tubes.front()){ 82 87 this->tubes.pop(); 83 88 levelUp(); 84 point++;85 89 } 86 90 while((this->asteroids.front())->getPosition().x<x-300){ … … 93 97 void FlappyOrx::levelUp() 94 98 { 95 level++; 99 point++; 100 spawnDistance = 300-3*point; 101 getPlayer()->setSpeed(100+.5*point); 96 102 toggleShowLevel(); 97 103 //showLevelTimer.setTimer(3.0f, false, createExecutor(createFunctor(&FlappyOrx::toggleShowLevel, this))); … … 111 117 void FlappyOrx::spawnTube() 112 118 { 113 int space = 90;119 int space = 120; 114 120 int height = (float(rand())/RAND_MAX-0.5)*(280-space); 115 121 … … 129 135 ClearAsteroids(); 130 136 Circle newAsteroid = Circle(); 137 newAsteroid.x=x; 138 newAsteroid.y=y; 139 newAsteroid.r=r; 140 addIfPossible(newAsteroid); 131 141 while(r>0){ 132 142 if(slope>0) … … 224 234 if (Highscore::exists()){ 225 235 int score = this->getPoints(); 226 if(score > Highscore::getInstance().getHighestScoreOfGame("Orxonox Arcade")) 227 Highscore::getInstance().storeHighscore("Orxonox Arcade",score); 228 229 } 230 point = 0; 236 if(score > Highscore::getInstance().getHighestScoreOfGame("Flappy Orx")) 237 Highscore::getInstance().storeHighscore("Flappy Orx",score); 238 239 } 240 point = -1; 241 level=-1; 242 levelUp(); 231 243 while (!tubes.empty()) 232 244 { -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
r11543 r11554 54 54 55 55 } 56 57 56 58 void FlappyOrxShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) 57 59 {
Note: See TracChangeset
for help on using the changeset viewer.