Changeset 11565 for code/branches/FlappyOrx_HS17/src/modules/flappyorx
- Timestamp:
- Nov 20, 2017, 1:35:53 PM (7 years ago)
- Location:
- code/branches/FlappyOrx_HS17/src/modules/flappyorx
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
r11563 r11565 67 67 point = 0; 68 68 bShowLevel = false; 69 sDeathMessage = "hallihallo"; 70 bIsDead = true; 69 71 multiplier = 1; 70 72 b_combo = false; … … 77 79 78 80 if(this->tubes.size()==0||x-tubes.back()+tubeOffsetX>spawnDistance){ 79 orxout()<<"true: ";80 81 spawnTube(); 81 82 this->tubes.push(x+tubeOffsetX); 82 83 } 83 else{84 orxout()<<"false:";85 }86 orxout()<<"x("<<x<<")- tubes.back()("<<tubes.back()<<") + tubeOffsetX("<<tubeOffsetX<<") > spawnDistance("<<spawnDistance<<")"<<std::endl;87 84 if(this->tubes.size()!=0&&x>this->tubes.front()){ 88 85 this->tubes.pop(); … … 166 163 167 164 void FlappyOrx::createAsteroid(Circle &c){ 168 orxout() << "created Asteroid at x="<<c.x<<" y="<<c.y << std::endl;169 170 165 MovableEntity* newAsteroid = new MovableEntity(this->center_->getContext()); 171 166 … … 200 195 201 196 bool FlappyOrx::isDead(){ 202 return true;197 return bIsDead; 203 198 } 204 199 205 200 std::string FlappyOrx::getDeathMessage(){ 206 return "hello world";201 return sDeathMessage; 207 202 } 208 203 … … 241 236 242 237 void FlappyOrx::death(){ 238 bIsDead = true; 239 sDeathMessage = "GameOver"; 243 240 if (Highscore::exists()){ 244 241 int score = this->getPoints(); 245 242 if(score > Highscore::getInstance().getHighestScoreOfGame("Flappy Orx")) 246 243 Highscore::getInstance().storeHighscore("Flappy Orx",score); 247 248 244 } 249 245 point = -1; -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h
r11563 r11565 96 96 bool bEndGame; 97 97 bool bShowLevel; 98 bool bIsDead; 99 std::string sDeathMessage; 98 100 std::queue<int> tubes; 99 101 std::queue<MovableEntity*> asteroids; -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc
r11563 r11565 66 66 if (this->FlappyOrxGame) 67 67 { 68 // if (this->bShowLives_) //preperation for easy mode 69 // { 70 // const std::string& lives = multi_cast<std::string>(this->InvaderGame->getLives()); 71 // this->setCaption(lives); 72 // } 73 if(this->bShowPoints_) 74 { 75 const std::string& points = multi_cast<std::string>(this->FlappyOrxGame->getPoints()); 76 if (not this->FlappyOrxGame->isDead()) 77 { 68 if(not this->FlappyOrxGame->isDead()){ 69 if(this->bShowPoints_){ 70 const std::string& points = multi_cast<std::string>(this->FlappyOrxGame->getPoints()); 78 71 setTextSize(0.04); 79 72 setPosition(Vector2(0.14, 0.02)); … … 81 74 this->setCaption(points); 82 75 } 76 else if(this->bShowGameOver_){ 77 setTextSize(0); 78 } 83 79 } 84 if(this->bShowGameOver_){85 if(this-> FlappyOrxGame->isDead()){80 else{ 81 if(this->bShowGameOver_){ 86 82 std::string message = this->FlappyOrxGame->getDeathMessage(); 87 setTextSize(0. 4);83 setTextSize(0.1); 88 84 setPosition(Vector2(.5, .5)); 89 85 this->setCaption(message); 90 86 this->setColour(ColourValue(1, 0, 0, 1)); 91 87 } 92 93 } 94 88 } 95 89 } 96 90 } -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
r11554 r11565 52 52 this->speed = 1; 53 53 this->gravity = 1; 54 isDead = true; 54 55 55 56 } … … 68 69 SUPER(FlappyOrxShip, tick, dt); 69 70 //Execute movement 70 if (this->hasLocalController() )71 if (this->hasLocalController()&¬ isDead) 71 72 { 72 73 if(getHealth()<0){ … … 127 128 128 129 void FlappyOrxShip::boost(bool boost){ 130 if(isDead){ 131 isDead = false; 132 getGame()->bIsDead = false; 133 } 129 134 isFlapping=boost; 130 135 } -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h
r11514 r11565 83 83 Camera* camera; 84 84 bool isFlapping; 85 bool isDead; 85 86 float speed, UpwardThrust, gravity; 86 87 struct Velocity
Note: See TracChangeset
for help on using the changeset viewer.