Changeset 11576 for code/branches
- Timestamp:
- Nov 20, 2017, 3:26:31 PM (7 years ago)
- Location:
- code/branches/FlappyOrx_HS17
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FlappyOrx_HS17/data/overlays/FlappyOrxHUD.oxo
r11566 r11576 19 19 20 20 <FlappyOrxHUDinfo 21 position = "0.02, 0.01" 21 position = "0.5, 0.5" 22 pickpoint = "0.0, 0.0" 23 font = "ShareTechMono" 24 textsize = 0.04 25 colour = "1.0, 0.0, 0.0, 1.0" 26 align = "center" 27 28 showmessage = true 29 messageID = 0 30 31 /> 32 33 <FlappyOrxHUDinfo 34 position = "0.5, 0.6" 35 pickpoint = "0.0, 0.0" 36 font = "ShareTechMono" 37 textsize = 0.04 38 colour = "1.0, 1.0, 1.0, 1.0" 39 align = "center" 40 41 showmessage = true 42 messageID = 1 43 /> 44 <FlappyOrxHUDinfo 45 position = "0.5, 0.65" 22 46 pickpoint = "0.0, 0.0" 23 47 font = "ShareTechMono" 24 48 textsize = 0.04 25 49 colour = "1.0, 1.0, 1.0, 1.0" 26 align = " left"50 align = "center" 27 51 28 52 showmessage = true 53 messageID = 2 29 54 /> 30 31 <!-- <FlappyOrxHUDinfo 32 position = "0.14, 0.01" 55 <FlappyOrxHUDinfo 56 position = "0.5, 0.7" 33 57 pickpoint = "0.0, 0.0" 34 58 font = "ShareTechMono" 35 59 textsize = 0.04 36 60 colour = "1.0, 1.0, 1.0, 1.0" 37 align = " left"61 align = "center" 38 62 39 showlives = true 40 showpoints = false 63 showmessage = true 64 messageID = 3 65 41 66 /> 42 67 43 <OverlayText 44 position = "0.14, 0.02" 45 pickpoint = "0.0, 0.0" 46 font = "ShareTechMono" 47 textsize = 0.04 48 colour = "1.0, 1.0, 1.0, 1.0" 49 align = "left" 50 caption = "Lives: " 51 /> --> 68 52 69 </OverlayGroup> 53 70 </Template> -
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.