Changeset 11760
- Timestamp:
- Feb 17, 2018, 11:50:25 PM (7 years ago)
- Location:
- code/branches/Presentation_HS17_merge/src/modules/flappyorx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.cc
r11759 r11760 142 142 143 143 //Fill up triangle with asteroids 144 while(noadd<5&&circlesUsed< nCircles){144 while(noadd<5&&circlesUsed<NUM_CIRCLES){ 145 145 if(slope>0) 146 146 newAsteroid.y=rnd(150+y)-150; //create asteroid on bottom … … 187 187 void FlappyOrx::clearCircles(){ 188 188 circlesUsed=0; 189 for(int i = 0; i< this->nCircles; i++){189 for(int i = 0; i<NUM_CIRCLES; i++){ 190 190 circles[i].r=0; 191 191 } … … 206 206 int FlappyOrx::addIfPossible(Circle c){ 207 207 int i; 208 for(i=0; i< this->nCircles&& this->circles[i].r!=0 && c.r>0;i++){208 for(i=0; i<NUM_CIRCLES && this->circles[i].r!=0 && c.r>0;i++){ 209 209 while(circleCollision(c,this->circles[i])){ 210 210 c.r-=5; //when it collides, try to make it smaller -
code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.h
r11758 r11760 83 83 84 84 FlappyOrxShip* getPlayer(); 85 86 float speedBase;87 float speedIncrease;88 89 float tubeDistanceBase;90 float tubeDistanceIncrease;91 float tubeDistance;92 float tubeOffsetX;93 85 94 86 inline void setSpeedBase(float speedBase){ this-> speedBase = speedBase;} … … 106 98 bool firstGame; 107 99 std::string sDeathMessage; 108 std::queue<float> tubes; //Saves Position of Tubes109 std::queue<MovableEntity*> asteroids; //Stores Asteroids which build up the tubes110 100 111 101 private: 112 113 const static int nCircles = 6;114 int circlesUsed;115 Circle circles[nCircles];116 117 102 void clearCircles(); 118 103 bool circleCollision(Circle &c1, Circle &c2); 119 104 int addIfPossible(Circle c); 120 105 121 WeakPtr<FlappyOrxShip> player;122 123 106 int point; 124 107 125 const int NUM_ASTEROIDS = 5; 108 float speedBase; 109 float speedIncrease; 126 110 111 float tubeDistanceBase; 112 float tubeDistanceIncrease; 113 float tubeDistance; 114 float tubeOffsetX; 127 115 128 const std::string Asteroid5[5] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5"}; 129 const std::string Asteroid10[5] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5"}; 130 const std::string Asteroid15[5] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5"}; 131 const std::string Asteroid20[5] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5"}; 116 WeakPtr<FlappyOrxShip> player; 117 std::queue<float> tubes; //Saves Position of Tubes 118 std::queue<MovableEntity*> asteroids; //Stores Asteroids which build up the tubes 119 120 const static int NUM_CIRCLES = 6; 121 int circlesUsed; 122 Circle circles[NUM_CIRCLES]; 123 124 const static int NUM_ASTEROIDS = 5; 125 126 const std::string Asteroid5[5] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5"}; 127 const std::string Asteroid10[5] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5"}; 128 const std::string Asteroid15[5] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5"}; 129 const std::string Asteroid20[5] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5"}; 132 130 133 std::vector<std::string> DeathMessage7 = {131 const std::vector<std::string> DeathMessage7 = { 134 132 "You should really try that again", 135 133 "You can do better, can you?", … … 142 140 "Here's a tip: Try not to fly into these grey thingies.", 143 141 "We won't comment on that."}; 144 std::vector<std::string> DeathMessage20 = {142 const std::vector<std::string> DeathMessage20 = { 145 143 "Getting better!", 146 144 "Training has paid off, huh?", … … 151 149 "That wasn't crap, not bad", 152 150 "Surprisingly not bad."}; 153 std::vector<std::string> DeathMessage30 = {151 const std::vector<std::string> DeathMessage30 = { 154 152 "Flappin great", 155 153 "Good job!", … … 158 156 "That was really good,!", 159 157 "We are proud of you"}; 160 std::vector<std::string> DeathMessageover30 = {158 const std::vector<std::string> DeathMessageover30 = { 161 159 "You're flappin amazing", 162 160 "Fucking great job", -
code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.cc
r11759 r11760 45 45 this->FlappyOrxGame = nullptr; 46 46 this->bShowPoints_ = false; 47 this->bShow GameOver_ = false;47 this->bShowMessage_ = false; 48 48 this->messageID = 0; 49 49 } … … 72 72 this->setCaption(points); 73 73 } 74 else if(this->bShow GameOver_){74 else if(this->bShowMessage_){ 75 75 setTextSize(0); 76 76 } … … 80 80 setTextSize(0); 81 81 } 82 else if(this->bShow GameOver_){82 else if(this->bShowMessage_){ 83 83 if(this->FlappyOrxGame->firstGame){ 84 84 if(messageID==3){ -
code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.h
r11758 r11760 51 51 52 52 inline void setShowMessage(bool value){ 53 bShow GameOver_ = value;53 bShowMessage_ = value; 54 54 } 55 55 inline bool getShowMessage() const 56 { return this->bShow GameOver_; }56 { return this->bShowMessage_; } 57 57 58 58 inline void setMessageID(int value){ … … 65 65 FlappyOrx* FlappyOrxGame; 66 66 bool bShowPoints_; 67 bool bShow GameOver_;67 bool bShowMessage_; 68 68 int messageID; 69 69 };
Note: See TracChangeset
for help on using the changeset viewer.