[11481] | 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: |
---|
[11624] | 23 | * Leo Merholz |
---|
[11598] | 24 | * Pascal Schärli |
---|
[11624] | 25 | * Co-authors: |
---|
| 26 | * ... |
---|
[11481] | 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 | |
---|
[11503] | 39 | #include "flappyorx/FlappyOrxPrereqs.h" |
---|
[11620] | 40 | |
---|
[11503] | 41 | |
---|
[11481] | 42 | #include "gametypes/Deathmatch.h" |
---|
[11580] | 43 | #include <vector> |
---|
[11481] | 44 | |
---|
| 45 | namespace orxonox |
---|
| 46 | { |
---|
[11529] | 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 | |
---|
[11481] | 63 | class _FlappyOrxExport FlappyOrx : public Deathmatch |
---|
| 64 | { |
---|
| 65 | public: |
---|
| 66 | FlappyOrx(Context* context); |
---|
| 67 | |
---|
| 68 | virtual void start() override; |
---|
| 69 | virtual void end() override; |
---|
[11537] | 70 | virtual void death(); |
---|
[11624] | 71 | |
---|
[11529] | 72 | void updatePlayerPos(int x); |
---|
| 73 | void createAsteroid(Circle &c); |
---|
| 74 | void asteroidField(int x, int y, float slope); |
---|
| 75 | void spawnTube(); |
---|
| 76 | |
---|
[11503] | 77 | void setCenterpoint(FlappyOrxCenterPoint* center); |
---|
[11600] | 78 | |
---|
[11503] | 79 | int getPoints(){return this->point;} |
---|
[11598] | 80 | |
---|
[11503] | 81 | void levelUp(); |
---|
[11598] | 82 | |
---|
[11563] | 83 | bool isDead(); |
---|
[11576] | 84 | void setDead(bool value); |
---|
[11595] | 85 | |
---|
| 86 | FlappyOrxShip* getPlayer(); |
---|
[11576] | 87 | |
---|
[11620] | 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 | |
---|
[11503] | 110 | bool bEndGame; |
---|
[11565] | 111 | bool bIsDead; |
---|
[11589] | 112 | bool firstGame; |
---|
[11565] | 113 | std::string sDeathMessage; |
---|
[11620] | 114 | std::queue<int> tubes; //Saves Position of Tubes |
---|
| 115 | std::queue<MovableEntity*> asteroids; //Stores Asteroids which build up the tubes |
---|
[11600] | 116 | float speed = 100; |
---|
[11595] | 117 | |
---|
[11481] | 118 | private: |
---|
[11598] | 119 | |
---|
| 120 | const static int nCircles = 6; |
---|
| 121 | int circlesUsed; |
---|
| 122 | Circle circles[nCircles]; |
---|
[11529] | 123 | |
---|
[11598] | 124 | void clearCircles(); |
---|
| 125 | bool circleCollision(Circle &c1, Circle &c2); |
---|
| 126 | int addIfPossible(Circle c); |
---|
[11529] | 127 | |
---|
[11503] | 128 | WeakPtr<FlappyOrxCenterPoint> center_; |
---|
| 129 | WeakPtr<FlappyOrxShip> player; |
---|
| 130 | |
---|
| 131 | int level; |
---|
| 132 | int point; |
---|
| 133 | bool b_combo; |
---|
[11529] | 134 | |
---|
[11580] | 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"}; |
---|
[11568] | 142 | |
---|
[11630] | 143 | std::vector<std::string> DeathMessage7 = { |
---|
[11574] | 144 | "You should really try that again", |
---|
[11572] | 145 | "You can do better, can you?", |
---|
[11596] | 146 | "Hey, maybe you get a participation award, that's good isn't it?", |
---|
[11580] | 147 | "Congratulations, you get a medal, a wooden one", |
---|
[11572] | 148 | "That was flappin bad!", |
---|
[11620] | 149 | "Well, that was a waste of time", |
---|
| 150 | "You suck!", |
---|
[11624] | 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."}; |
---|
[11630] | 154 | std::vector<std::string> DeathMessage20 = { |
---|
[11572] | 155 | "Getting better!", |
---|
[11574] | 156 | "Training has paid off, huh?", |
---|
| 157 | "Good average!", |
---|
| 158 | "That was somehow enjoyable to watch", |
---|
| 159 | "Flappin average", |
---|
[11596] | 160 | "Getting closer to something", |
---|
[11620] | 161 | "That wasn't crap, not bad", |
---|
| 162 | "Surprisingly not bad."}; |
---|
[11630] | 163 | std::vector<std::string> DeathMessage30 = { |
---|
[11574] | 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"}; |
---|
[11630] | 170 | std::vector<std::string> DeathMessageover30 = { |
---|
[11574] | 171 | "You're flappin amazing", |
---|
| 172 | "Fucking great job", |
---|
| 173 | "Wow, we're really impressed", |
---|
| 174 | "We will honor you!", |
---|
[11624] | 175 | "Please, please do that again!", |
---|
| 176 | "Take that golden medal! You've earned it", |
---|
| 177 | "We are completely speechless! That was magnificent"}; |
---|
[11537] | 178 | |
---|
[11529] | 179 | |
---|
| 180 | |
---|
[11537] | 181 | |
---|
[11481] | 182 | }; |
---|
| 183 | } |
---|
| 184 | |
---|
| 185 | #endif /* _FlappyOrx_H__ */ |
---|