Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 17, 2018, 11:50:25 PM (7 years ago)
Author:
landauf
Message:

[FlappyOrx_HS17] some cleanup

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  
    142142
    143143        //Fill up triangle with asteroids
    144         while(noadd<5&&circlesUsed<nCircles){
     144        while(noadd<5&&circlesUsed<NUM_CIRCLES){
    145145            if(slope>0)
    146146                newAsteroid.y=rnd(150+y)-150;   //create asteroid on bottom
     
    187187    void FlappyOrx::clearCircles(){
    188188        circlesUsed=0;
    189         for(int i = 0; i<this->nCircles; i++){
     189        for(int i = 0; i<NUM_CIRCLES; i++){
    190190            circles[i].r=0;
    191191        }
     
    206206    int FlappyOrx::addIfPossible(Circle c){
    207207        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++){
    209209            while(circleCollision(c,this->circles[i])){
    210210                c.r-=5; //when it collides, try to make it smaller
  • code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrx.h

    r11758 r11760  
    8383
    8484            FlappyOrxShip* getPlayer();
    85            
    86             float speedBase;
    87             float speedIncrease;
    88 
    89             float tubeDistanceBase;
    90             float tubeDistanceIncrease;
    91             float tubeDistance;
    92             float tubeOffsetX;
    9385
    9486            inline void setSpeedBase(float speedBase){ this-> speedBase =  speedBase;}
     
    10698            bool firstGame;
    10799            std::string sDeathMessage;
    108             std::queue<float> tubes;                  //Saves Position of Tubes
    109             std::queue<MovableEntity*> asteroids;   //Stores Asteroids which build up the tubes
    110100           
    111101        private:
    112              
    113             const static int nCircles = 6;
    114             int circlesUsed;
    115             Circle circles[nCircles];
    116 
    117102            void clearCircles();
    118103            bool circleCollision(Circle &c1, Circle &c2);
    119104            int addIfPossible(Circle c);
    120105
    121             WeakPtr<FlappyOrxShip> player;
    122 
    123106            int point;
    124107
    125             const int NUM_ASTEROIDS = 5;
     108            float speedBase;
     109            float speedIncrease;
    126110
     111            float tubeDistanceBase;
     112            float tubeDistanceIncrease;
     113            float tubeDistance;
     114            float tubeOffsetX;
    127115
    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"};
    132130           
    133             std::vector<std::string> DeathMessage7 = {
     131            const std::vector<std::string> DeathMessage7 = {
    134132                "You should really try that again",
    135133                "You can do better, can you?",
     
    142140                "Here's a tip: Try not to fly into these grey thingies.",
    143141                "We won't comment on that."};
    144             std::vector<std::string> DeathMessage20 = {
     142            const std::vector<std::string> DeathMessage20 = {
    145143                "Getting better!",
    146144                "Training has paid off, huh?",
     
    151149                "That wasn't crap, not bad",
    152150                "Surprisingly not bad."};
    153             std::vector<std::string> DeathMessage30 = {
     151            const std::vector<std::string> DeathMessage30 = {
    154152                "Flappin great",
    155153                "Good job!",
     
    158156                "That was really good,!",
    159157                "We are proud of you"};
    160             std::vector<std::string> DeathMessageover30 = {
     158            const std::vector<std::string> DeathMessageover30 = {
    161159                "You're flappin amazing",
    162160                "Fucking great job",
  • code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.cc

    r11759 r11760  
    4545        this->FlappyOrxGame = nullptr;
    4646        this->bShowPoints_ = false;
    47         this->bShowGameOver_ = false;
     47        this->bShowMessage_ = false;
    4848        this->messageID = 0;
    4949    }
     
    7272                    this->setCaption(points);
    7373                }
    74                 else if(this->bShowGameOver_){
     74                else if(this->bShowMessage_){
    7575                    setTextSize(0);
    7676                }
     
    8080                    setTextSize(0);
    8181                }
    82                 else if(this->bShowGameOver_){
     82                else if(this->bShowMessage_){
    8383                    if(this->FlappyOrxGame->firstGame){
    8484                        if(messageID==3){
  • code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxHUDinfo.h

    r11758 r11760  
    5151
    5252            inline void setShowMessage(bool value){
    53                 bShowGameOver_ = value;
     53                bShowMessage_ = value;
    5454            }
    5555            inline bool getShowMessage() const
    56                 { return this->bShowGameOver_; }
     56                { return this->bShowMessage_; }
    5757
    5858            inline void setMessageID(int value){
     
    6565            FlappyOrx* FlappyOrxGame;
    6666            bool bShowPoints_;
    67             bool bShowGameOver_;
     67            bool bShowMessage_;
    6868            int messageID;
    6969    };
Note: See TracChangeset for help on using the changeset viewer.