Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2017, 6:15:54 PM (7 years ago)
Author:
vyang
Message:

Asteroids2DStones erstellt, lassen sich ins Level laden, random spawn wenn position nicht als Attribut im XML File angegeben wird. Random Geschwindigkeit funktioniert noch nicht → vllt Einstellungen in Pawn bzw MovableEntity?, Gametype ein wenig aufgeraemt → am Anfang fuenf Asteroiden mit random Geschwindigkeit und Position spawnen

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

Legend:

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

    r11613 r11616  
    3434#include "Asteroids2D.h"
    3535#include "Asteroids2DShip.h" // Necessary for getPlayer function. Do NOT include this in Header!
     36#include "Asteroids2DStone.h"
    3637#include "core/CoreIncludes.h"
    3738#include "Highscore.h"
     
    4647
    4748        bEndGame = false;
    48         lives = 1;
     49        lives = 3;
    4950        level = 1;
    5051        point = 0;
     
    5253        multiplier = 1;
    5354        b_combo = false;
    54         counter = 5000;
    55         pattern = 1;
    56         lastPosition = 0;
     55        firstTick_ = true;
    5756        this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
    5857        this->center_ = nullptr;
     
    8786    void Asteroids2D::tick(float dt)
    8887    {
     88        //Do this only for the first tick, generate stones
     89        if(this->firstTick_)
     90        {
     91            for(int i = 0; i < 5; ++i)
     92            {
     93                spawnStone();
     94            }
     95            this->firstTick_ = false;
     96        }
    8997       
    9098        SUPER(Asteroids2D, tick, dt);
     99    }
     100
     101    void Asteroids2D::spawnStone()
     102    {
     103        if (getPlayer() == nullptr)
     104            return;
     105        Asteroids2DStone* newStone = new Asteroids2DStone(this->center_->getContext());
     106        newStone->setAsteroids2DPlayer(player);
     107        //addtemplate
     108
    91109    }
    92110
     
    151169        if (Highscore::exists()){
    152170                    int score = this->getPoints();
    153                     if(score > Highscore::getInstance().getHighestScoreOfGame("Dodge Race"))
    154                         Highscore::getInstance().storeHighscore("Dodge Race",score);
     171                    if(score > Highscore::getInstance().getHighestScoreOfGame("Asteroids2D"))
     172                        Highscore::getInstance().storeHighscore("Asteroids2D",score);
    155173
    156174          }
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h

    r11613 r11616  
    8282            int getMultiplier(){return this->multiplier;}
    8383
     84            void spawnStone();
    8485            void setCenterpoint(Asteroids2DCenterPoint* center)
    8586                       { this->center_ = center; }
     
    9495            int lives;
    9596            int multiplier;
    96             float counter;
    97             int pattern;
    98             float currentPosition;
    99             float lastPosition;
    10097
    10198       private:
     
    104101            Asteroids2DShip* getPlayer();
    105102            WeakPtr<Asteroids2DShip> player;
    106             std::vector<Asteroids2DCube*> cubeList;
    107103            void toggleShowLevel(){bShowLevel = !bShowLevel;}
    108104            void addPoints(int numPoints);
     
    111107            int level;
    112108            int point;
    113             bool b_combo;
     109            bool b_combo, firstTick_;
    114110
    115111            Timer enemySpawnTimer;
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/CMakeLists.txt

    r11608 r11616  
    33Asteroids2DCenterPoint.cc
    44Asteroids2DShip.cc
    5 Asteroids2DCube.cc
     5Asteroids2DStone.cc
    66Asteroids2DHUDinfo.cc
    77)
Note: See TracChangeset for help on using the changeset viewer.