/* * ORXONOX - the hottest 3D action shooter ever to exist * > www.orxonox.net < * * * License notice: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: * Florian Zinggeler * Co-authors: * ... * */ /** @file FlappyOrx.h @brief Gametype. @ingroup FlappyOrx */ #ifndef _FlappyOrx_H__ #define _FlappyOrx_H__ #include "flappyorx/FlappyOrxPrereqs.h" #include "gametypes/Deathmatch.h" #include "tools/Timer.h" #include namespace orxonox { struct Circle{ int r; int x; int y; Circle(int new_r, int new_x, int new_y){ r=new_r; x=new_x; y=new_y; } Circle(){ r=0; x=0; y=0; } }; class _FlappyOrxExport FlappyOrx : public Deathmatch { public: FlappyOrx(Context* context); virtual void start() override; virtual void end() override; virtual void death(); virtual void addBots(unsigned int amount) override{} //lives;} int getLevel(){return this->level;} int getPoints(){return this->point;} int getMultiplier(){return this->multiplier;} void costLife(); void levelUp(); void addPoints(int numPoints); // checks if multiplier should be reset. void comboControll(); bool isDead(); void setDead(bool value); FlappyOrxShip* getPlayer(); int lives; int multiplier; bool bEndGame; bool bShowLevel; bool bIsDead; bool firstGame; std::string sDeathMessage; std::queue tubes; std::queue asteroids; int spawnDistance; int tubeOffsetX; private: void toggleShowLevel(){bShowLevel = !bShowLevel;} const static int nAst = 7; Circle Asteroids[nAst]; void ClearAsteroids(){ for(int i = 0; inAst; i++){ Asteroids[i].r=0; } } bool Collision(Circle &c1, Circle &c2){ if(c1.r==0 || c2.r==0) return false; int x = c1.x - c2.x; int y = c1.y - c2.y; int r = c1.r + c2.r; return x*x+y*ynAst && this->Asteroids[i].r!=0;i++){ if(Collision(c,this->Asteroids[i])){ return 0; } } if(i==nAst) return 2; this->Asteroids[i].x=c.x; this->Asteroids[i].y=c.y; this->Asteroids[i].r=c.r; createAsteroid(c); return 1; } WeakPtr center_; WeakPtr player; Timer enemySpawnTimer; Timer comboTimer; Timer showLevelTimer; //Context* context; int level; int point; bool b_combo; const int NUM_ASTEROIDS = 5; const std::string Asteroid5[5] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5"}; const std::string Asteroid10[5] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5"}; const std::string Asteroid15[5] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5"}; const std::string Asteroid20[5] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5"}; std::vector DeathMessage10 = { "You should really try that again", "You can do better, can you?", "Hey, maybe you get a participation award, that's good isn't it?", "Congratulations, you get a medal, a wooden one", "That was flappin bad!", "Well, that was a waste of time"}; std::vector DeathMessage30 = { "Getting better!", "Training has paid off, huh?", "Good average!", "That was somehow enjoyable to watch", "Flappin average", "Getting closer to something", "That wasn't crap, not bad"}; std::vector DeathMessage50 = { "Flappin great", "Good job!", "Okay, we give you a shiny medal, not a golden one, tough", "Maybe you should do that professionally", "That was really good,!", "We are proud of you"}; std::vector DeathMessageover50 = { "You're flappin amazing", "Fucking great job", "Wow, we're really impressed", "We will honor you!", "Please do that again!", "Take that golden medal! You've earned it"}; }; } #endif /* _FlappyOrx_H__ */