Orxonox  0.0.5 Codename: Arcturus
Asteroids2D.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Viviane Yang
24  * Co-authors:
25  * ...
26  *
27  */
28 
29 
30 
40 #ifndef _Asteroids2D_H__
41 #define _Asteroids2D_H__
42 
44 
45 #include "gametypes/Deathmatch.h"
46 #include "tools/Timer.h"
47 
48 namespace orxonox
49 {
50 
52  {
53  public:
54  Asteroids2D(Context* context);
55 
56  virtual void start() override;
57  virtual void end() override;
58 
59  //updates the game every few ns
60  virtual void tick(float dt) override;
61 
62  virtual void playerPreSpawn(PlayerInfo* player) override;
63 
64  void levelUp();
65 
66 
67  //For HUD
68  int getLives(){return this->lives;}
69  int getLevel(){return this->level;}
70  int getPoints(){return this->point;}
71  int getMultiplier(){return this->multiplier;}
72 
73  //Generate Stones
74  void spawnStone();
75  void setCenterpoint(Asteroids2DCenterPoint* center);
76 
77  void addPoints(int numPoints);
78  virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
79 
80  // checks if multiplier should be reset.
81  void costLife();
82 
83  //Returns player (ship) of the game
84  Asteroids2DShip* getPlayer();
85 
86  bool bEndGame;
87  bool bShowLevel;
88  int lives;
90 
91 
92  private:
93 
94 
95 
97  void toggleShowLevel(){bShowLevel = !bShowLevel;}
98 
100  int level;
101  int point;
102  bool b_combo, firstTick_;
103 
108 
109 
110  };
111 }
112 
113 #endif /* _Asteroids2D_H__ */
int lives
Definition: Asteroids2D.h:88
Definition: Asteroids2D.h:51
Timer showLevelTimer
Definition: Asteroids2D.h:105
Definition: Asteroids2DCenterPoint.h:44
bool bEndGame
Definition: Asteroids2D.h:86
int getPoints()
Definition: Asteroids2D.h:70
WeakPtr< PlayerInfo > playerInfo_
Definition: Asteroids2D.h:96
Definition: Asteroids2DShip.h:45
Timer comboTimer
Definition: Asteroids2D.h:104
WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted.
Definition: CorePrereqs.h:236
WeakPtr< Asteroids2DCenterPoint > center_
Definition: Asteroids2D.h:99
Timer levelupTimer
Definition: Asteroids2D.h:106
int getLives()
Definition: Asteroids2D.h:68
Declaration of the Timer class, used to call functions after a given time-interval.
Shared library macros, enums, constants and forward declarations for the Asteroids2D module ...
int point
Definition: Asteroids2D.h:101
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
#define _Asteroids2DExport
Definition: Asteroids2DPrereqs.h:60
int getMultiplier()
Definition: Asteroids2D.h:71
int multiplier
Definition: Asteroids2D.h:89
Definition: Context.h:45
int getLevel()
Definition: Asteroids2D.h:69
virtual void addBots(unsigned int amount) override
Definition: Asteroids2D.h:78
bool bShowLevel
Definition: Asteroids2D.h:87
void toggleShowLevel()
Definition: Asteroids2D.h:97
Definition: Deathmatch.h:37
Definition: PlayerInfo.h:39
Timer endGameTimer
Definition: Asteroids2D.h:107
bool firstTick_
Definition: Asteroids2D.h:102
Timer is a helper class that executes a function after a given amount of seconds in game-time...
Definition: Timer.h:105
int level
Definition: Asteroids2D.h:100