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 | * Leo Merholz |
---|
24 | * Pascal Schärli |
---|
25 | * Co-authors: |
---|
26 | * ... |
---|
27 | * |
---|
28 | */ |
---|
29 | |
---|
30 | /** |
---|
31 | @file FlappyOrx.h |
---|
32 | @brief Gametype. |
---|
33 | @ingroup FlappyOrx |
---|
34 | */ |
---|
35 | |
---|
36 | #ifndef _FlappyOrx_H__ |
---|
37 | #define _FlappyOrx_H__ |
---|
38 | |
---|
39 | #include "flappyorx/FlappyOrxPrereqs.h" |
---|
40 | |
---|
41 | |
---|
42 | #include "gametypes/Deathmatch.h" |
---|
43 | #include <vector> |
---|
44 | |
---|
45 | namespace orxonox |
---|
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 | |
---|
72 | void updatePlayerPos(int x); |
---|
73 | void createAsteroid(Circle &c); |
---|
74 | void asteroidField(int x, int y, float slope); |
---|
75 | void spawnTube(); |
---|
76 | |
---|
77 | void setCenterpoint(FlappyOrxCenterPoint* center); |
---|
78 | |
---|
79 | int getPoints(){return this->point;} |
---|
80 | |
---|
81 | void levelUp(); |
---|
82 | |
---|
83 | bool isDead(); |
---|
84 | void setDead(bool value); |
---|
85 | |
---|
86 | FlappyOrxShip* getPlayer(); |
---|
87 | |
---|
88 | float speedBase; |
---|
89 | float speedIncrease; |
---|
90 | |
---|
91 | int tubeDistanceBase; |
---|
92 | int tubeDistanceIncrease; |
---|
93 | int tubeDistance; |
---|
94 | int tubeOffsetX; |
---|
95 | |
---|
96 | int upwardThrust; |
---|
97 | int gravity; |
---|
98 | |
---|
99 | inline void setSpeedBase(int speedBase){ this-> speedBase = speedBase;} |
---|
100 | inline float getSpeedBase(){ return speedBase;} |
---|
101 | inline void setSpeedIncrease(int speedIncrease){ this-> speedIncrease = speedIncrease;} |
---|
102 | inline float getSpeedIncrease(){ return speedIncrease;} |
---|
103 | |
---|
104 | inline void setTubeDistanceBase(int tubeDistanceBase){ this-> tubeDistanceBase = tubeDistanceBase;} |
---|
105 | inline int getTubeDistanceBase(){ return tubeDistanceBase;} |
---|
106 | inline void setTubeDistanceIncrease(int tubeDistanceIncrease){ this-> tubeDistanceIncrease = tubeDistanceIncrease;} |
---|
107 | inline int getTubeDistanceIncrease(){ return tubeDistanceIncrease;} |
---|
108 | |
---|
109 | |
---|
110 | bool bEndGame; |
---|
111 | bool bIsDead; |
---|
112 | bool firstGame; |
---|
113 | std::string sDeathMessage; |
---|
114 | std::queue<int> tubes; //Saves Position of Tubes |
---|
115 | std::queue<MovableEntity*> asteroids; //Stores Asteroids which build up the tubes |
---|
116 | float speed = 100; |
---|
117 | |
---|
118 | private: |
---|
119 | |
---|
120 | const static int nCircles = 6; |
---|
121 | int circlesUsed; |
---|
122 | Circle circles[nCircles]; |
---|
123 | |
---|
124 | void clearCircles(); |
---|
125 | bool circleCollision(Circle &c1, Circle &c2); |
---|
126 | int addIfPossible(Circle c); |
---|
127 | |
---|
128 | WeakPtr<FlappyOrxCenterPoint> center_; |
---|
129 | WeakPtr<FlappyOrxShip> player; |
---|
130 | |
---|
131 | int level; |
---|
132 | int point; |
---|
133 | bool b_combo; |
---|
134 | |
---|
135 | const int NUM_ASTEROIDS = 5; |
---|
136 | |
---|
137 | |
---|
138 | const std::string Asteroid5[5] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5"}; |
---|
139 | const std::string Asteroid10[5] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5"}; |
---|
140 | const std::string Asteroid15[5] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5"}; |
---|
141 | const std::string Asteroid20[5] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5"}; |
---|
142 | |
---|
143 | std::vector<std::string> DeathMessage7 = { |
---|
144 | "You should really try that again", |
---|
145 | "You can do better, can you?", |
---|
146 | "Hey, maybe you get a participation award, that's good isn't it?", |
---|
147 | "Congratulations, you get a medal, a wooden one", |
---|
148 | "That was flappin bad!", |
---|
149 | "Well, that was a waste of time", |
---|
150 | "You suck!", |
---|
151 | "Maybe try SuperOrxoBros. That game is not as hard.", |
---|
152 | "Here's a tip: Try not to fly into these grey thingies.", |
---|
153 | "We won't comment on that."}; |
---|
154 | std::vector<std::string> DeathMessage20 = { |
---|
155 | "Getting better!", |
---|
156 | "Training has paid off, huh?", |
---|
157 | "Good average!", |
---|
158 | "That was somehow enjoyable to watch", |
---|
159 | "Flappin average", |
---|
160 | "Getting closer to something", |
---|
161 | "That wasn't crap, not bad", |
---|
162 | "Surprisingly not bad."}; |
---|
163 | std::vector<std::string> DeathMessage30 = { |
---|
164 | "Flappin great", |
---|
165 | "Good job!", |
---|
166 | "Okay, we give you a shiny medal, not a golden one, tough", |
---|
167 | "Maybe you should do that professionally", |
---|
168 | "That was really good,!", |
---|
169 | "We are proud of you"}; |
---|
170 | std::vector<std::string> DeathMessageover30 = { |
---|
171 | "You're flappin amazing", |
---|
172 | "Fucking great job", |
---|
173 | "Wow, we're really impressed", |
---|
174 | "We will honor you!", |
---|
175 | "Please, please do that again!", |
---|
176 | "Take that golden medal! You've earned it", |
---|
177 | "We are completely speechless! That was magnificent"}; |
---|
178 | |
---|
179 | |
---|
180 | |
---|
181 | |
---|
182 | }; |
---|
183 | } |
---|
184 | |
---|
185 | #endif /* _FlappyOrx_H__ */ |
---|