[Orxonox-commit 7143] r11760 - code/branches/Presentation_HS17_merge/src/modules/flappyorx
landauf at orxonox.net
landauf at orxonox.net
Sat Feb 17 23:50:25 CET 2018
Author: landauf
Date: 2018-02-17 23:50:25 +0100 (Sat, 17 Feb 2018)
New Revision: 11760
Modified:
code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.cc
code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.h
code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.cc
code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.h
Log:
[FlappyOrx_HS17] some cleanup
Modified: code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.cc 2018-02-17 22:43:12 UTC (rev 11759)
+++ code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.cc 2018-02-17 22:50:25 UTC (rev 11760)
@@ -141,7 +141,7 @@
addIfPossible(newAsteroid); //Add Asteroid at peak
//Fill up triangle with asteroids
- while(noadd<5&&circlesUsed<nCircles){
+ while(noadd<5&&circlesUsed<NUM_CIRCLES){
if(slope>0)
newAsteroid.y=rnd(150+y)-150; //create asteroid on bottom
else
@@ -186,7 +186,7 @@
//Deletes Asteroids array which stores all the circles used to make sure no asteroids collide when spawning
void FlappyOrx::clearCircles(){
circlesUsed=0;
- for(int i = 0; i<this->nCircles; i++){
+ for(int i = 0; i<NUM_CIRCLES; i++){
circles[i].r=0;
}
}
@@ -205,7 +205,7 @@
//Adds a circle if its not colliding
int FlappyOrx::addIfPossible(Circle c){
int i;
- for(i=0; i<this->nCircles && this->circles[i].r!=0 && c.r>0;i++){
+ for(i=0; i<NUM_CIRCLES && this->circles[i].r!=0 && c.r>0;i++){
while(circleCollision(c,this->circles[i])){
c.r-=5; //when it collides, try to make it smaller
}
Modified: code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.h 2018-02-17 22:43:12 UTC (rev 11759)
+++ code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.h 2018-02-17 22:50:25 UTC (rev 11760)
@@ -82,15 +82,7 @@
void setDead(bool value);
FlappyOrxShip* getPlayer();
-
- float speedBase;
- float speedIncrease;
- float tubeDistanceBase;
- float tubeDistanceIncrease;
- float tubeDistance;
- float tubeOffsetX;
-
inline void setSpeedBase(float speedBase){ this-> speedBase = speedBase;}
inline float getSpeedBase(){ return speedBase;}
inline void setSpeedIncrease(float speedIncrease){ this-> speedIncrease = speedIncrease;}
@@ -105,32 +97,38 @@
bool bIsDead;
bool firstGame;
std::string sDeathMessage;
- std::queue<float> tubes; //Saves Position of Tubes
- std::queue<MovableEntity*> asteroids; //Stores Asteroids which build up the tubes
private:
-
- const static int nCircles = 6;
- int circlesUsed;
- Circle circles[nCircles];
-
void clearCircles();
bool circleCollision(Circle &c1, Circle &c2);
int addIfPossible(Circle c);
+ int point;
+
+ float speedBase;
+ float speedIncrease;
+
+ float tubeDistanceBase;
+ float tubeDistanceIncrease;
+ float tubeDistance;
+ float tubeOffsetX;
+
WeakPtr<FlappyOrxShip> player;
+ std::queue<float> tubes; //Saves Position of Tubes
+ std::queue<MovableEntity*> asteroids; //Stores Asteroids which build up the tubes
- int point;
+ const static int NUM_CIRCLES = 6;
+ int circlesUsed;
+ Circle circles[NUM_CIRCLES];
- const int NUM_ASTEROIDS = 5;
+ const static int NUM_ASTEROIDS = 5;
-
- const std::string Asteroid5[5] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5"};
- const std::string Asteroid10[5] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5"};
- const std::string Asteroid15[5] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5"};
- const std::string Asteroid20[5] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5"};
+ const std::string Asteroid5[5] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5"};
+ const std::string Asteroid10[5] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5"};
+ const std::string Asteroid15[5] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5"};
+ const std::string Asteroid20[5] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5"};
- std::vector<std::string> DeathMessage7 = {
+ const std::vector<std::string> DeathMessage7 = {
"You should really try that again",
"You can do better, can you?",
"Hey, maybe you get a participation award, that's good isn't it?",
@@ -141,7 +139,7 @@
"Maybe try SuperOrxoBros. That game is not as hard.",
"Here's a tip: Try not to fly into these grey thingies.",
"We won't comment on that."};
- std::vector<std::string> DeathMessage20 = {
+ const std::vector<std::string> DeathMessage20 = {
"Getting better!",
"Training has paid off, huh?",
"Good average!",
@@ -150,7 +148,7 @@
"Getting closer to something",
"That wasn't crap, not bad",
"Surprisingly not bad."};
- std::vector<std::string> DeathMessage30 = {
+ const std::vector<std::string> DeathMessage30 = {
"Flappin great",
"Good job!",
"Okay, we give you a shiny medal, not a golden one, tough",
@@ -157,7 +155,7 @@
"Maybe you should do that professionally",
"That was really good,!",
"We are proud of you"};
- std::vector<std::string> DeathMessageover30 = {
+ const std::vector<std::string> DeathMessageover30 = {
"You're flappin amazing",
"Fucking great job",
"Wow, we're really impressed",
Modified: code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.cc 2018-02-17 22:43:12 UTC (rev 11759)
+++ code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.cc 2018-02-17 22:50:25 UTC (rev 11760)
@@ -44,7 +44,7 @@
this->FlappyOrxGame = nullptr;
this->bShowPoints_ = false;
- this->bShowGameOver_ = false;
+ this->bShowMessage_ = false;
this->messageID = 0;
}
@@ -71,7 +71,7 @@
setTextSize(0.04);
this->setCaption(points);
}
- else if(this->bShowGameOver_){
+ else if(this->bShowMessage_){
setTextSize(0);
}
}
@@ -79,7 +79,7 @@
if(this->bShowPoints_){
setTextSize(0);
}
- else if(this->bShowGameOver_){
+ else if(this->bShowMessage_){
if(this->FlappyOrxGame->firstGame){
if(messageID==3){
setTextSize(0.05);
Modified: code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.h 2018-02-17 22:43:12 UTC (rev 11759)
+++ code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.h 2018-02-17 22:50:25 UTC (rev 11760)
@@ -50,10 +50,10 @@
{ return this->bShowPoints_; }
inline void setShowMessage(bool value){
- bShowGameOver_ = value;
+ bShowMessage_ = value;
}
inline bool getShowMessage() const
- { return this->bShowGameOver_; }
+ { return this->bShowMessage_; }
inline void setMessageID(int value){
messageID = value;
@@ -64,7 +64,7 @@
private:
FlappyOrx* FlappyOrxGame;
bool bShowPoints_;
- bool bShowGameOver_;
+ bool bShowMessage_;
int messageID;
};
}
More information about the Orxonox-commit
mailing list