Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11565


Ignore:
Timestamp:
Nov 20, 2017, 1:35:53 PM (6 years ago)
Author:
pascscha
Message:

death message initiated2

Location:
code/branches/FlappyOrx_HS17/src/modules/flappyorx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc

    r11563 r11565  
    6767        point = 0;
    6868        bShowLevel = false;
     69        sDeathMessage = "hallihallo";
     70        bIsDead = true;
    6971        multiplier = 1;
    7072        b_combo = false;
     
    7779
    7880        if(this->tubes.size()==0||x-tubes.back()+tubeOffsetX>spawnDistance){
    79             orxout()<<"true: ";
    8081            spawnTube();
    8182            this->tubes.push(x+tubeOffsetX);
    8283        }
    83         else{
    84             orxout()<<"false:";
    85         }
    86         orxout()<<"x("<<x<<")- tubes.back()("<<tubes.back()<<") + tubeOffsetX("<<tubeOffsetX<<") > spawnDistance("<<spawnDistance<<")"<<std::endl;
    8784        if(this->tubes.size()!=0&&x>this->tubes.front()){
    8885            this->tubes.pop();
     
    166163
    167164    void FlappyOrx::createAsteroid(Circle &c){
    168         orxout() << "created Asteroid at x="<<c.x<<" y="<<c.y << std::endl;
    169 
    170165        MovableEntity* newAsteroid = new MovableEntity(this->center_->getContext());
    171166
     
    200195
    201196    bool FlappyOrx::isDead(){
    202         return true;
     197        return bIsDead;
    203198    }
    204199
    205200    std::string FlappyOrx::getDeathMessage(){
    206         return "hello world";
     201        return sDeathMessage;
    207202    }
    208203
     
    241236
    242237    void FlappyOrx::death(){
     238        bIsDead = true;
     239        sDeathMessage = "GameOver";
    243240        if (Highscore::exists()){
    244241                    int score = this->getPoints();
    245242                    if(score > Highscore::getInstance().getHighestScoreOfGame("Flappy Orx"))
    246243                        Highscore::getInstance().storeHighscore("Flappy Orx",score);
    247 
    248244        }
    249245        point = -1;
  • code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h

    r11563 r11565  
    9696            bool bEndGame;
    9797            bool bShowLevel;
     98            bool bIsDead;
     99            std::string sDeathMessage;
    98100            std::queue<int> tubes;
    99101            std::queue<MovableEntity*> asteroids;
  • code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc

    r11563 r11565  
    6666        if (this->FlappyOrxGame)
    6767        {
    68             // if (this->bShowLives_)  //preperation for easy mode
    69             // {
    70             //     const std::string& lives = multi_cast<std::string>(this->InvaderGame->getLives());
    71             //     this->setCaption(lives);
    72             // }
    73             if(this->bShowPoints_)
    74             {
    75                 const std::string& points = multi_cast<std::string>(this->FlappyOrxGame->getPoints());
    76                 if (not this->FlappyOrxGame->isDead())
    77                 {
     68            if(not this->FlappyOrxGame->isDead()){
     69                if(this->bShowPoints_){
     70                    const std::string& points = multi_cast<std::string>(this->FlappyOrxGame->getPoints());
    7871                    setTextSize(0.04);
    7972                    setPosition(Vector2(0.14, 0.02));
     
    8174                    this->setCaption(points);
    8275                }
     76                else if(this->bShowGameOver_){
     77                    setTextSize(0);
     78                }
    8379            }
    84             if(this->bShowGameOver_){
    85                 if(this->FlappyOrxGame->isDead()){
     80            else{
     81                if(this->bShowGameOver_){
    8682                    std::string message = this->FlappyOrxGame->getDeathMessage();
    87                     setTextSize(0.4);
     83                    setTextSize(0.1);
    8884                    setPosition(Vector2(.5, .5));
    8985                    this->setCaption(message);
    9086                    this->setColour(ColourValue(1, 0, 0, 1));
    9187                }
    92 
    93             }
    94            
     88            }   
    9589        }
    9690    }
  • code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc

    r11554 r11565  
    5252        this->speed = 1;
    5353        this->gravity = 1;
     54        isDead = true;
    5455       
    5556    }
     
    6869        SUPER(FlappyOrxShip, tick, dt);
    6970        //Execute movement
    70         if (this->hasLocalController())
     71        if (this->hasLocalController()&&not isDead)
    7172        {
    7273            if(getHealth()<0){
     
    127128
    128129    void FlappyOrxShip::boost(bool boost){
     130        if(isDead){
     131            isDead = false;
     132            getGame()->bIsDead = false;
     133        }
    129134        isFlapping=boost;
    130135    }
  • code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h

    r11514 r11565  
    8383            Camera* camera;
    8484            bool isFlapping;
     85            bool isDead;
    8586            float speed, UpwardThrust, gravity;
    8687            struct Velocity
Note: See TracChangeset for help on using the changeset viewer.