Changeset 11576 for code/branches/FlappyOrx_HS17/src/modules
- Timestamp:
- Nov 20, 2017, 3:26:31 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
r11566 r11576 67 67 point = 0; 68 68 bShowLevel = false; 69 sDeathMessage = "Welcome to FlappyOrx \nPress Space to start!";69 sDeathMessage = "Welcome to FlappyOrx"; 70 70 bIsDead = true; 71 71 multiplier = 1; … … 198 198 } 199 199 200 std::string FlappyOrx::getDeathMessage(){ 201 return sDeathMessage; 200 void FlappyOrx::setDead(bool value){ 201 bIsDead = value; 202 if(not value){ 203 point = -1; 204 level=-1; 205 levelUp(); 206 } 202 207 } 203 208 … … 237 242 void FlappyOrx::death(){ 238 243 bIsDead = true; 239 sDeathMessage = "GameOver"; 244 245 if(point<10) sDeathMessage = DeathMessage10[rand()%(sizeof(DeathMessage10)/sizeof(*DeathMessage10))]; 246 else if(point<30) sDeathMessage = DeathMessage30[rand()%(sizeof(DeathMessage30)/sizeof(*DeathMessage30))]; 247 else if(point<50) sDeathMessage = DeathMessage50[rand()%(sizeof(DeathMessage50)/sizeof(*DeathMessage50))]; 248 else sDeathMessage = DeathMessageover50[rand()%(sizeof(DeathMessageover50)/sizeof(*DeathMessageover50))]; 249 250 orxout()<<"message: "<<sDeathMessage<<std::endl; 251 252 240 253 if (Highscore::exists()){ 241 254 int score = this->getPoints(); … … 243 256 Highscore::getInstance().storeHighscore("Flappy Orx",score); 244 257 } 245 point = -1;246 level=-1;247 levelUp();248 258 while (!tubes.empty()) 249 259 { -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h
r11574 r11576 90 90 91 91 bool isDead(); 92 std::string getDeathMessage();93 92 void setDead(bool value); 93 94 94 int lives; 95 95 int multiplier; -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc
r11566 r11576 53 53 SUPER(FlappyOrxHUDinfo, XMLPort, xmlelement, mode); 54 54 55 XMLPortParam(FlappyOrxHUDinfo, "showlives", setShowLives, getShowLives, xmlelement, mode).defaultValues(false);56 55 XMLPortParam(FlappyOrxHUDinfo, "showpoints", setShowPoints, getShowPoints, xmlelement, mode).defaultValues(false); 57 56 XMLPortParam(FlappyOrxHUDinfo, "showmessage", setShowMessage, getShowMessage, xmlelement, mode).defaultValues(false); 57 XMLPortParam(FlappyOrxHUDinfo, "messageID", setMessageID, getMessageID, xmlelement, mode).defaultValues(0); 58 58 59 59 … … 70 70 const std::string& points = "Score: "+multi_cast<std::string>(this->FlappyOrxGame->getPoints()); 71 71 setTextSize(0.04); 72 setPosition(Vector2(0.14, 0.02));73 this->setColour(ColourValue(1, 1, 1, 1));74 72 this->setCaption(points); 75 73 } … … 83 81 } 84 82 else if(this->bShowGameOver_){ 85 std::string message = this->FlappyOrxGame->getDeathMessage(); 86 setTextSize(0.1); 87 setPosition(Vector2(.5, .5)); 88 89 setAlignment(OverlayText::Alignment::Center); 90 83 std::string message; 84 setTextSize(0.05); 85 switch(messageID){ 86 case 0: 87 message = "Game Over"; 88 setTextSize(0.1); 89 this->setCaption(message); 90 break; 91 case 1: 92 message = this->FlappyOrxGame->sDeathMessage; 93 break; 94 case 2: 95 message = "Your Score: "+multi_cast<std::string>(this->FlappyOrxGame->getPoints())+ 96 " Local High Score: "+multi_cast<std::string>(Highscore::getInstance().getHighestScoreOfGame("Flappy Orx")); 97 break; 98 case 3: 99 message = "Press space to restart."; 100 break; 101 } 91 102 this->setCaption(message); 92 this->setColour(ColourValue(1, 0, 0, 1));93 103 } 94 104 } -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.h
r11563 r11576 71 71 { return this->bShowGameOver_; } 72 72 73 inline void setMessageID(int value){ 74 messageID = value; 75 } 76 inline int getMessageID() const 77 { return messageID; } 78 79 80 73 81 74 82 private: … … 79 87 bool bShowMultiplier_; 80 88 bool bShowGameOver_; 89 int messageID; 81 90 std::string sGameOverMessage_; 82 91 }; -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
r11566 r11576 131 131 if(isDead){ 132 132 isDead = false; 133 getGame()-> bIsDead = false;133 getGame()->setDead(false); 134 134 } 135 135 isFlapping=boost;
Note: See TracChangeset
for help on using the changeset viewer.