Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2017, 1:29:44 PM (7 years ago)
Author:
vyang
Message:

Asteroids2DShip ist 3s immun, nachdem es von einem Asteroiden getroffen wurde. Das Raumschiff hat nun eine Waffe → Richtung der Projektile muss noch angepasst werden

Location:
code/branches/Asteroid_HS17/src/modules/asteroids2D
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc

    r11637 r11645  
    5252
    5353        bEndGame = false;
    54         lives = 5;
     54        lives = 1000;
    5555        level = 1;
    5656        point = 0;
     
    158158    };
    159159   
    160 
     160//Funktion wird als erstes im Level aufgerufen
    161161    void Asteroids2D::start()
    162162    {
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.cc

    r11637 r11645  
    4141
    4242        this->Asteroids2DGame = nullptr;
    43         this->Ship = nullptr;
     43        //this->Ship = nullptr;
    4444        this->bShowPoints_ = true;
    4545        this->bShowHealth_ = true;
     
    5151
    5252        XMLPortParam(Asteroids2DHUDinfo,"showPoints", setShowPoints, getShowPoints, xmlelement, mode).defaultValues(false);
    53         XMLPortParam(Asteroids2DHUDinfo,"showHealth", setShowHealth, getShowHealth, xmlelement, mode).defaultValues(false);
    5453    }
    5554
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.h

    r11637 r11645  
    6161        private:
    6262            Asteroids2D* Asteroids2DGame;
    63             Asteroids2DShip* Ship;
     63            bool bShowLives_;
     64            bool bShowLevel_;
    6465            bool bShowPoints_;
    6566            bool bShowHealth_;
     67
    6668    };
    6769}
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc

    r11643 r11645  
    9898    {
    9999
    100         orxout() << "touched" << endl;
    101100        Asteroids2DStone* stone = orxonox_cast<Asteroids2DStone*>(otherObject);       
    102         if(stone != nullptr && (stone != lastStone || lastStone == nullptr))
     101        if(stone != nullptr && !bImmune)
    103102        {
    104103            removeHealth(100);
    105             lastStone = stone;
    106          
     104            this->getGame()->addPoints(10);
     105
     106            //The ship will be immune for 3 seconds after it has been hit by an asteroid
     107            bImmune = true;
     108            isimmune.setTimer(3.0f, false, createExecutor(createFunctor(&Asteroids2DShip::toggleImmune, this)));
     109            orxout()<< "touched" << endl;
    107110        }
    108111        return false;
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.h

    r11643 r11645  
    6868            virtual void rotateRoll(const Vector2& value) override{}; // Rotate in roll direction.
    6969
    70 
    71 
    7270            virtual void updateLevel();
    7371
     
    7775            bool isFireing;
    7876            void showposition();
     77            void toggleImmune()
     78            {
     79                bImmune = !bImmune;
     80            }
    7981
    8082        protected:
     
    8688            float width, height;
    8789            WeakPtr<Asteroids2D> game;
    88             WeakPtr<Asteroids2DStone> lastStone;
    89 
     90            bool bImmune;
    9091            Timer timer;
     92            Timer isimmune;
    9193    };
    9294}
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/CMakeLists.txt

    r11616 r11645  
    55Asteroids2DStone.cc
    66Asteroids2DHUDinfo.cc
     7Asteroids2DWeapon.cc
    78)
    89
Note: See TracChangeset for help on using the changeset viewer.