Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h @ 11574

Last change on this file since 11574 was 11574, checked in by merholzl, 6 years ago

more death textes

File size: 6.2 KB
Line 
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 *      Florian Zinggeler
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file FlappyOrx.h
31    @brief Gametype.
32    @ingroup FlappyOrx
33*/
34
35#ifndef _FlappyOrx_H__
36#define _FlappyOrx_H__
37
38#include "flappyorx/FlappyOrxPrereqs.h"
39
40#include "gametypes/Deathmatch.h"
41#include "tools/Timer.h"
42
43
44namespace orxonox
45{
46
47    struct Circle{
48        int r;
49        int x;
50        int y;
51        Circle(int new_r, int new_x, int new_y){
52            r=new_r;
53            x=new_x;
54            y=new_y;
55        }
56        Circle(){
57            r=0;
58            x=0;
59            y=0;
60        }
61    };
62
63    class _FlappyOrxExport FlappyOrx : public Deathmatch
64    {
65        public:
66            FlappyOrx(Context* context);
67
68            virtual void start() override;
69            virtual void end() override;
70            virtual void death();
71            virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
72
73            void updatePlayerPos(int x);
74            void createAsteroid(Circle &c);
75            void asteroidField(int x, int y, float slope);
76            void spawnTube();
77           
78            void setCenterpoint(FlappyOrxCenterPoint* center);
79
80            int getLives(){return this->lives;}
81            int getLevel(){return this->level;}
82            int getPoints(){return this->point;}
83            int getMultiplier(){return this->multiplier;}
84
85            void costLife();
86            void levelUp();
87            void addPoints(int numPoints);
88            // checks if multiplier should be reset.
89            void comboControll();
90
91            bool isDead();
92            std::string getDeathMessage();
93
94            int lives;
95            int multiplier;
96            bool bEndGame;
97            bool bShowLevel;
98            bool bIsDead;
99            std::string sDeathMessage;
100            std::queue<int> tubes;
101            std::queue<MovableEntity*> asteroids;
102            int spawnDistance;
103            int tubeOffsetX;
104        private:
105            void toggleShowLevel(){bShowLevel = !bShowLevel;}
106           
107            const static int nAst = 7;
108            Circle Asteroids[nAst];
109
110            void ClearAsteroids(){
111                for(int i = 0; i<this->nAst; i++){
112                    Asteroids[i].r=0;
113                }
114            }
115
116           
117            bool Collision(Circle &c1, Circle &c2){
118                if(c1.r==0 || c2.r==0)
119                    return false;
120                int x = c1.x - c2.x;
121                int y = c1.y - c2.y;
122                int r = c1.r + c2.r;
123
124                return x*x+y*y<r*r*1.5;
125            }
126
127            int addIfPossible(Circle c){
128                int i;
129                for(i=0; i<this->nAst && this->Asteroids[i].r!=0;i++){
130                    if(Collision(c,this->Asteroids[i])){
131                        return 0;
132                    }
133                }
134                if(i==nAst)
135                    return 2;
136                this->Asteroids[i].x=c.x;
137                this->Asteroids[i].y=c.y;
138                this->Asteroids[i].r=c.r;
139                createAsteroid(c);
140                return 1;
141            }
142           
143           
144
145            FlappyOrxShip* getPlayer();
146            WeakPtr<FlappyOrxCenterPoint> center_;
147            WeakPtr<FlappyOrxShip> player;
148
149            Timer enemySpawnTimer;
150            Timer comboTimer;
151            Timer showLevelTimer;
152            //Context* context;
153            int level;
154            int point;
155            bool b_combo;
156
157            const std::string Asteroid5[6] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5","Asteroid3_6"};
158            const std::string Asteroid10[6] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5","Asteroid6_6"};
159            const std::string Asteroid15[6] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5","Asteroid9_6"};
160            const std::string Asteroid20[6] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5","Asteroid12_6"};
161           
162            const std::string DeathMessage10[7] = {
163                "You should really try that again",
164                "You can do better, can you?",
165                "Hey maybe you get a paticipation award, that's good isn't it?",
166                "Hey congratulations, you get an medal, a wooden one",
167                "That was flappin bad!",
168                "Getting closer to something",
169                "Well that was a waste of time"};
170            const std::string DeathMessage30[6] = {
171                "Getting better!",
172                "Training has paid off, huh?",
173                "Good average!",
174                "That was somehow enjoyable to watch",
175                "Flappin average",
176                "That wasn't crap, not bad"};
177            const std::string DeathMessage50[6] = {
178                "Flappin great",
179                "Good job!",
180                "Okay, we give you a shiny medal, not a golden one, tough",
181                "Maybe you should do that professionally",
182                "That was really good,!",
183                "We are proud of you"};
184            const std::string DeathMessageover50[6] = {
185                "You're flappin amazing",
186                "Fucking great job",
187                "Wow, we're really impressed",
188                "We will honor you!",
189                "Please do that again!",
190                "Take that golden medal! You've earned it"};
191           
192
193
194
195    };
196}
197
198#endif /* _FlappyOrx_H__ */
Note: See TracBrowser for help on using the repository browser.