/* * 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" 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(); int lives; int multiplier; bool bEndGame; bool bShowLevel; 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; } FlappyOrxShip* getPlayer(); WeakPtr center_; WeakPtr player; Timer enemySpawnTimer; Timer comboTimer; Timer showLevelTimer; //Context* context; int level; int point; bool b_combo; const std::string Asteroid5[6] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5","Asteroid3_6"}; const std::string Asteroid10[6] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5","Asteroid6_6"}; const std::string Asteroid15[6] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5","Asteroid9_6"}; const std::string Asteroid20[6] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5","Asteroid12_6"}; }; } #endif /* _FlappyOrx_H__ */