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
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Asteroid_HS17/data/levels/templates/spaceshipAsteroids2D.oxt

    r11637 r11645  
    4343  >
    4444    <engines>
    45       <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipinvaderengine />
    46       <MultiStateEngine position="-7.6, 0, 0" template=spaceshipinvaderengine />
     45      <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipasteroids2dengine />
     46      <MultiStateEngine position="-7.6, 0, 0" template=spaceshipasteroids2dengine />
    4747    </engines>
    4848    <attached>
     
    7272    </explosion>
    7373<?lua
    74   include("../includes/invaderWeapon.oxi")
     74  include("../includes/asteroids2DWeapon.oxi")
    7575?>
    7676  </Asteroids2DShip>
     
    9393</Template>
    9494
    95 <Template name=spaceshipinvaderengine baseclass=MultiStateEngine>
     95<Template name=spaceshipasteroids2dengine baseclass=MultiStateEngine>
    9696  <MultiStateEngine
    9797   boostfactor    = 2.2
     
    111111   accelerationupdown    =  500
    112112  >
     113
     114  <!-- backlight error if you fly over the edge
    113115    <EffectContainer condition="idle">
    114116      <WorldSound mainstate="activity" source="sounds/Engine_idle.ogg" looping=1 active=false/>
     
    130132    </EffectContainer>
    131133
     134  -->
     135
    132136  </MultiStateEngine>
    133137</Template>
  • code/branches/Asteroid_HS17/data/overlays/Asteroids2DHUD.oxo

    r11608 r11645  
    66<Template name="Asteroids2DHUD">
    77  <OverlayGroup name="Asteroids2DHUD" scale = "1, 1">
     8
     9    <OverlayText
     10     position  = "0.02, 0.1"
     11     pickpoint = "0.0, 0.0"
     12     font      = "ShareTechMono"
     13     textsize  = 0.04
     14     colour    = "1.0, 1.0, 1.0, 1.0"
     15     align     = "left"
     16     caption   = "Lives:   "
     17    />
     18
     19    <Asteroids2DHUDinfo
     20     position  = "0.14, 0.1"
     21     pickpoint = "0.0, 0.0"
     22     font      = "ShareTechMono"
     23     textsize  = 0.04
     24     colour    = "1.0, 1.0, 1.0, 1.0"
     25     align     = "left"
     26
     27     showlives     = true
     28     showlevel     = false
     29     showpoints     = false
     30    />
    831
    932    <OverlayText
     
    2851    />
    2952
     53    <OverlayText
     54     position  = "0.02, 0.055"
     55     pickpoint = "0.0, 0.0"
     56     font      = "ShareTechMono"
     57     textsize  = 0.04
     58     colour    = "1.0, 1.0, 1.0, 1.0"
     59     align     = "left"
     60     caption   = "Level: "
     61    />
     62
     63    <Asteroids2DHUDinfo
     64     position  = "0.14, 0.055"
     65     pickpoint = "0.0, 0.0"
     66     font      = "ShareTechMono"
     67     textsize  = 0.04
     68     colour    = "1.0, 1.0, 1.0, 1.0"
     69     align     = "left"
     70
     71     showlives     = false
     72     showlevel     = true
     73     showpoints     = false
     74    />
     75
    3076   
    3177  </OverlayGroup>
  • 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.