[11593] | 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: |
---|
[11660] | 23 | * Viviane Yang |
---|
[11593] | 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
[11617] | 29 | |
---|
| 30 | |
---|
[11593] | 31 | /** |
---|
| 32 | @file Asteroids2D.h |
---|
[11660] | 33 | @brief Gametype: |
---|
| 34 | - Goal: Survive as long as you can, do not collide with stones |
---|
| 35 | - spawns stones in every level up |
---|
| 36 | - if you shoot and hit a stone, it will spit into two smaller stones |
---|
[11593] | 37 | @ingroup Asteroids2D |
---|
| 38 | */ |
---|
| 39 | |
---|
| 40 | #ifndef _Asteroids2D_H__ |
---|
| 41 | #define _Asteroids2D_H__ |
---|
| 42 | |
---|
| 43 | #include "asteroids2D/Asteroids2DPrereqs.h" |
---|
| 44 | |
---|
| 45 | #include "gametypes/Deathmatch.h" |
---|
[11608] | 46 | #include "tools/Timer.h" |
---|
[11593] | 47 | |
---|
| 48 | namespace orxonox |
---|
| 49 | { |
---|
| 50 | |
---|
| 51 | class _Asteroids2DExport Asteroids2D : public Deathmatch |
---|
| 52 | { |
---|
| 53 | public: |
---|
| 54 | Asteroids2D(Context* context); |
---|
| 55 | |
---|
| 56 | virtual void start() override; |
---|
| 57 | virtual void end() override; |
---|
[11608] | 58 | |
---|
[11668] | 59 | //updates the game every few ns |
---|
[11593] | 60 | virtual void tick(float dt) override; |
---|
| 61 | |
---|
[11608] | 62 | virtual void playerPreSpawn(PlayerInfo* player) override; |
---|
| 63 | |
---|
| 64 | void levelUp(); |
---|
| 65 | |
---|
[11637] | 66 | |
---|
| 67 | //For HUD |
---|
[11608] | 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 | |
---|
[11637] | 73 | //Generate Stones |
---|
[11616] | 74 | void spawnStone(); |
---|
[11727] | 75 | void setCenterpoint(Asteroids2DCenterPoint* center); |
---|
| 76 | |
---|
[11637] | 77 | void addPoints(int numPoints); |
---|
[11608] | 78 | virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command |
---|
[11593] | 79 | |
---|
[11608] | 80 | // checks if multiplier should be reset. |
---|
| 81 | void costLife(); |
---|
[11668] | 82 | |
---|
| 83 | //Returns player (ship) of the game |
---|
[11637] | 84 | Asteroids2DShip* getPlayer(); |
---|
[11608] | 85 | |
---|
[11593] | 86 | bool bEndGame; |
---|
[11608] | 87 | bool bShowLevel; |
---|
| 88 | int lives; |
---|
| 89 | int multiplier; |
---|
[11593] | 90 | |
---|
[11669] | 91 | |
---|
[11593] | 92 | private: |
---|
| 93 | |
---|
[11619] | 94 | |
---|
[11637] | 95 | |
---|
[11729] | 96 | WeakPtr<PlayerInfo> playerInfo_; |
---|
[11608] | 97 | void toggleShowLevel(){bShowLevel = !bShowLevel;} |
---|
| 98 | |
---|
[11593] | 99 | WeakPtr<Asteroids2DCenterPoint> center_; |
---|
[11608] | 100 | int level; |
---|
| 101 | int point; |
---|
[11616] | 102 | bool b_combo, firstTick_; |
---|
[11593] | 103 | |
---|
[11608] | 104 | Timer comboTimer; |
---|
| 105 | Timer showLevelTimer; |
---|
[11617] | 106 | Timer levelupTimer; |
---|
| 107 | Timer endGameTimer; |
---|
[11593] | 108 | |
---|
[11619] | 109 | |
---|
[11593] | 110 | }; |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | #endif /* _Asteroids2D_H__ */ |
---|