[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{ |
---|
[11755] | 48 | float r; |
---|
| 49 | float x; |
---|
| 50 | float y; |
---|
| 51 | Circle(float new_r, float new_x, float new_y){ |
---|
[11529] | 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 | |
---|
[11755] | 72 | void updatePlayerPos(float x); |
---|
[11529] | 73 | void createAsteroid(Circle &c); |
---|
[11755] | 74 | void asteroidField(float x, float y, float slope); |
---|
[11529] | 75 | void spawnTube(); |
---|
[11600] | 76 | |
---|
[11503] | 77 | int getPoints(){return this->point;} |
---|
[11598] | 78 | |
---|
[11503] | 79 | void levelUp(); |
---|
[11598] | 80 | |
---|
[11563] | 81 | bool isDead(); |
---|
[11576] | 82 | void setDead(bool value); |
---|
[11595] | 83 | |
---|
| 84 | FlappyOrxShip* getPlayer(); |
---|
[11576] | 85 | |
---|
[11620] | 86 | float speedBase; |
---|
| 87 | float speedIncrease; |
---|
| 88 | |
---|
[11755] | 89 | float tubeDistanceBase; |
---|
| 90 | float tubeDistanceIncrease; |
---|
| 91 | float tubeDistance; |
---|
| 92 | float tubeOffsetX; |
---|
[11620] | 93 | |
---|
[11755] | 94 | inline void setSpeedBase(float speedBase){ this-> speedBase = speedBase;} |
---|
[11620] | 95 | inline float getSpeedBase(){ return speedBase;} |
---|
[11755] | 96 | inline void setSpeedIncrease(float speedIncrease){ this-> speedIncrease = speedIncrease;} |
---|
[11620] | 97 | inline float getSpeedIncrease(){ return speedIncrease;} |
---|
| 98 | |
---|
[11755] | 99 | inline void setTubeDistanceBase(float tubeDistanceBase){ this-> tubeDistanceBase = tubeDistanceBase;} |
---|
| 100 | inline float getTubeDistanceBase(){ return tubeDistanceBase;} |
---|
| 101 | inline void setTubeDistanceIncrease(float tubeDistanceIncrease){ this-> tubeDistanceIncrease = tubeDistanceIncrease;} |
---|
| 102 | inline float getTubeDistanceIncrease(){ return tubeDistanceIncrease;} |
---|
[11620] | 103 | |
---|
| 104 | |
---|
[11565] | 105 | bool bIsDead; |
---|
[11589] | 106 | bool firstGame; |
---|
[11565] | 107 | std::string sDeathMessage; |
---|
[11755] | 108 | std::queue<float> tubes; //Saves Position of Tubes |
---|
[11620] | 109 | std::queue<MovableEntity*> asteroids; //Stores Asteroids which build up the tubes |
---|
[11595] | 110 | |
---|
[11481] | 111 | private: |
---|
[11598] | 112 | |
---|
| 113 | const static int nCircles = 6; |
---|
| 114 | int circlesUsed; |
---|
| 115 | Circle circles[nCircles]; |
---|
[11529] | 116 | |
---|
[11598] | 117 | void clearCircles(); |
---|
| 118 | bool circleCollision(Circle &c1, Circle &c2); |
---|
| 119 | int addIfPossible(Circle c); |
---|
[11529] | 120 | |
---|
[11503] | 121 | WeakPtr<FlappyOrxShip> player; |
---|
| 122 | |
---|
| 123 | int point; |
---|
[11529] | 124 | |
---|
[11580] | 125 | const int NUM_ASTEROIDS = 5; |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | const std::string Asteroid5[5] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5"}; |
---|
| 129 | const std::string Asteroid10[5] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5"}; |
---|
| 130 | const std::string Asteroid15[5] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5"}; |
---|
| 131 | const std::string Asteroid20[5] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5"}; |
---|
[11568] | 132 | |
---|
[11630] | 133 | std::vector<std::string> DeathMessage7 = { |
---|
[11574] | 134 | "You should really try that again", |
---|
[11572] | 135 | "You can do better, can you?", |
---|
[11596] | 136 | "Hey, maybe you get a participation award, that's good isn't it?", |
---|
[11580] | 137 | "Congratulations, you get a medal, a wooden one", |
---|
[11572] | 138 | "That was flappin bad!", |
---|
[11620] | 139 | "Well, that was a waste of time", |
---|
| 140 | "You suck!", |
---|
[11624] | 141 | "Maybe try SuperOrxoBros. That game is not as hard.", |
---|
| 142 | "Here's a tip: Try not to fly into these grey thingies.", |
---|
| 143 | "We won't comment on that."}; |
---|
[11630] | 144 | std::vector<std::string> DeathMessage20 = { |
---|
[11572] | 145 | "Getting better!", |
---|
[11574] | 146 | "Training has paid off, huh?", |
---|
| 147 | "Good average!", |
---|
| 148 | "That was somehow enjoyable to watch", |
---|
| 149 | "Flappin average", |
---|
[11596] | 150 | "Getting closer to something", |
---|
[11620] | 151 | "That wasn't crap, not bad", |
---|
| 152 | "Surprisingly not bad."}; |
---|
[11630] | 153 | std::vector<std::string> DeathMessage30 = { |
---|
[11574] | 154 | "Flappin great", |
---|
| 155 | "Good job!", |
---|
| 156 | "Okay, we give you a shiny medal, not a golden one, tough", |
---|
| 157 | "Maybe you should do that professionally", |
---|
| 158 | "That was really good,!", |
---|
| 159 | "We are proud of you"}; |
---|
[11630] | 160 | std::vector<std::string> DeathMessageover30 = { |
---|
[11574] | 161 | "You're flappin amazing", |
---|
| 162 | "Fucking great job", |
---|
| 163 | "Wow, we're really impressed", |
---|
| 164 | "We will honor you!", |
---|
[11624] | 165 | "Please, please do that again!", |
---|
| 166 | "Take that golden medal! You've earned it", |
---|
| 167 | "We are completely speechless! That was magnificent"}; |
---|
[11537] | 168 | |
---|
[11529] | 169 | |
---|
| 170 | |
---|
[11537] | 171 | |
---|
[11481] | 172 | }; |
---|
| 173 | } |
---|
| 174 | |
---|
| 175 | #endif /* _FlappyOrx_H__ */ |
---|