Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11617


Ignore:
Timestamp:
Dec 3, 2017, 6:02:22 PM (6 years ago)
Author:
vyang
Message:

spawnEnemy und Templates für die 3 Grössen der Asteroiden geschrieben.

Location:
code/branches/Asteroid_HS17
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Asteroid_HS17/data/levels/Asteroids2D.oxw

    r11616 r11617  
    1717  include("templates/enemyInvader.oxt")
    1818  include("overlays/Asteroids2DHUD.oxo")
     19  include("templates/asteroidsAsteroids2D.oxt)
    1920?>
    2021
  • code/branches/Asteroid_HS17/data/levels/templates/asteroidsAsteroids2D.oxt

    r11614 r11617  
     1<Template name = stone1>
     2  <Asteroids2DStone
     3    collisionType = dynamic
     4    linearDamping = 0.8
     5    angularDamping = 1
     6    scale= 10
     7    enablecollisiondamage = true
     8
     9    health            = 10
     10    maxhealth         = 10
     11    initialhealth     = 10
     12  >
     13    <attached>
     14      <Model mass= 4000 mesh="ast1.mesh" />
     15    </attached>
     16    <collisionShapes>
     17      <SphereCollisionShape radius="10" />
     18    </collisionShapes>
     19  </Asteroids2DStone>
     20</Template>
     21
     22<Template name = stone2>
     23  <Asteroids2DStone
     24    collisionType = dynamic
     25    linearDamping = 0.8
     26    angularDamping = 1
     27    scale= 20
     28    enablecollisiondamage = true
     29
     30    health            = 10
     31    maxhealth         = 10
     32    initialhealth     = 10
     33  >
     34    <attached>
     35      <Model mass= 8000 mesh="ast2.mesh" />
     36    </attached>
     37    <collisionShapes>
     38      <SphereCollisionShape radius="20" />
     39    </collisionShapes>
     40  </Asteroids2DStone>
     41</Template>
     42
     43<Template name = stone3>
     44  <Asteroids2DStone
     45    collisionType = dynamic
     46    linearDamping = 0.8
     47    angularDamping = 1
     48    scale= 30
     49    enablecollisiondamage = true
     50
     51    health            = 10
     52    maxhealth         = 10
     53    initialhealth     = 10
     54  >
     55    <attached>
     56      <Model mass= 16000 mesh="ast3.mesh" />
     57    </attached>
     58    <collisionShapes>
     59      <SphereCollisionShape radius="30" />
     60    </collisionShapes>
     61  </Asteroids2DStone>
     62</Template>
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc

    r11616 r11617  
    2626 *
    2727 */
     28
     29/*TODO: Punktesystem aufbauen -> in HUD anzeigen
     30        Schwierigkeitsgrad mit jedem levelup erhöhen -> mehr Steine spawnen?
     31        spawnStone Methode schreiben
     32        templates für die drei Grössen von Asteroiden erstellen
    2833
    2934/**
     
    5762        this->center_ = nullptr;
    5863        this->setHUDTemplate("Asteroids2DHUD");
     64        levelupTimer.setTimer(100.0f, true, createExecutor(createFunctor(&Asteroids2D::levelUp, this)));
    5965    }
    6066
     
    8288        toggleShowLevel();
    8389        showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&Asteroids2D::toggleShowLevel, this)));
     90        //Nach jedem Level Up werden mehr Steine gespawnt -> abhängig vom Schwierigkeitsgrad
     91        for(int i = 0; i < level*2; i++){
     92            spawnStone();
     93        }
     94
    8495    }
    8596
    8697    void Asteroids2D::tick(float dt)
    8798    {
    88         //Do this only for the first tick, generate stones
     99        //Do this only for the first tick, generate 5 stones for the beginning
    89100        if(this->firstTick_)
    90101        {
     
    105116        Asteroids2DStone* newStone = new Asteroids2DStone(this->center_->getContext());
    106117        newStone->setAsteroids2DPlayer(player);
    107         //addtemplate
     118
     119        switch(newStone->getSize()){
     120            case 1:
     121                newStone->addTemplate("stone1");
     122                break;
     123            case 2:
     124                newStone->addTemplate("stone2");
     125                break;
     126            case 3:
     127                newStone->addTemplate("stone3");
     128                break;
     129            default:
     130                orxout(internal_error) << "Asteroids2DStone has invalid size and cannot be created" << endl;
     131                break;
     132
     133        }
     134
    108135
    109136    }
     
    123150    void Asteroids2D::costLife()
    124151    {
    125         //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&Asteroids2D::end, this)));
    126         lives = 0;
     152        --lives;
     153        if(live <= 0){
     154            endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&Asteroids2D::end, this)));           
     155        }
    127156    };
     157   
    128158
    129159    void Asteroids2D::start()
     
    152182    }
    153183
     184    //wird gerufen, falls man einen Asteroiden trifft->Aufruf durch Schiffklasse
    154185    void Asteroids2D::addPoints(int numPoints)
    155186    {
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h

    r11616 r11617  
    2626 *
    2727 */
     28
     29
    2830
    2931/**
     
    109111            bool b_combo, firstTick_;
    110112
    111             Timer enemySpawnTimer;
    112113            Timer comboTimer;
    113114            Timer showLevelTimer;
     115            Timer levelupTimer;
     116            Timer endGameTimer;
    114117
    115 
    116          /*
    117 
    118             //void spawnEnemy();
    119 
    120 
    121 
    122 
    123 
    124 
    125 
    126 
    127 
    128 
    129 
    130 
    131         private:
    132 
    133 
    134 
    135 
    136             //Context* context;
    137             */
    138118    };
    139119}
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc

    r11613 r11617  
    2727 */
    2828
     29/*TODO: orientation/direction of the ship must be defined
     30        implement shoot function ->or switch it on?
     31        switch off boosting particles in the back of the ship
     32
    2933/**
    3034    @file Asteroids2DShip.cc
     
    4953        this->height = 646;
    5054
    51         // not sure if has to be zero?
    52         lastTimeFront = 0;
    53         lastTimeLeft = 0;
    54         lastTime = 0;
    5555        timer.setTimer(3.5f, true, createExecutor(createFunctor(&Asteroids2DShip::showposition, this)));
    5656    }
     
    8585    void Asteroids2DShip::updateLevel()
    8686    {
    87         lastTime = 0;
    8887        if (getGame())
    8988            getGame()->levelUp();
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.h

    r11614 r11617  
    8787            WeakPtr<Asteroids2D> game;
    8888            WeakPtr<WorldEntity> lastEntity;
    89             float lastTimeFront, lastTimeLeft, lastTime;
    9089            struct Velocity
    9190            {
Note: See TracChangeset for help on using the changeset viewer.