Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h @ 11600

Last change on this file since 11600 was 11600, checked in by merholzl, 6 years ago

XML Ports and cleanUp

File size: 5.4 KB
Line 
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 Mehr Holz
24 *      Pascal Schärli
25 *
26 */
27
28/**
29    @file FlappyOrx.h
30    @brief Gametype.
31    @ingroup FlappyOrx
32*/
33
34#ifndef _FlappyOrx_H__
35#define _FlappyOrx_H__
36
37#include "flappyorx/FlappyOrxPrereqs.h"
38
39#include "gametypes/Deathmatch.h"
40#include <vector>
41
42namespace orxonox
43{
44    struct Circle{
45        int r;
46        int x;
47        int y;
48        Circle(int new_r, int new_x, int new_y){
49            r=new_r;
50            x=new_x;
51            y=new_y;
52        }
53        Circle(){
54            r=0;
55            x=0;
56            y=0;
57        }
58    };
59
60    class _FlappyOrxExport FlappyOrx : public Deathmatch
61    {
62        public:
63            FlappyOrx(Context* context);
64
65            virtual void start() override;
66            virtual void end() override;
67            virtual void death();
68            virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
69            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
70           
71            void setspawnDistance( int spawnDistance)
72                {this->spawnDistance = spawnDistance; }
73            int getspawnDistance()
74                { return this->spawnDistance; } 
75            inline void setSpeed( float speed ){   
76                orxout()<< speed<< endl;
77                this->speed = speed; }
78            inline float getSpeed( )
79                { return this->speed; }
80
81            void updatePlayerPos(int x);
82            void createAsteroid(Circle &c);
83            void asteroidField(int x, int y, float slope);
84            void spawnTube();
85           
86            void setCenterpoint(FlappyOrxCenterPoint* center);
87           
88            int getPoints(){return this->point;}
89           
90            void levelUp();
91           
92            bool isDead();
93            void setDead(bool value);
94
95            FlappyOrxShip* getPlayer();
96           
97            bool bEndGame;
98            bool bIsDead;
99            bool firstGame;
100            std::string sDeathMessage;
101            std::queue<int> tubes;
102            std::queue<MovableEntity*> asteroids;
103            int spawnDistance;
104            int tubeOffsetX;
105            float speed = 100;
106           
107        private:
108             
109            const static int nCircles = 6;
110            int circlesUsed;
111            Circle circles[nCircles];
112
113            void clearCircles();
114            bool circleCollision(Circle &c1, Circle &c2);
115            int addIfPossible(Circle c);
116
117            WeakPtr<FlappyOrxCenterPoint> center_;
118            WeakPtr<FlappyOrxShip> player;
119
120            int level;
121            int point;
122            bool b_combo;
123
124            const int NUM_ASTEROIDS = 5;
125
126
127           const std::string Asteroid5[5] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5"};
128           const std::string Asteroid10[5] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5"};
129           const std::string Asteroid15[5] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5"};
130           const std::string Asteroid20[5] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5"};
131           
132            std::vector<std::string> DeathMessage10 = {
133                "You should really try that again",
134                "You can do better, can you?",
135                "Hey, maybe you get a participation award, that's good isn't it?",
136                "Congratulations, you get a medal, a wooden one",
137                "That was flappin bad!",
138                "Well, that was a waste of time"};
139            std::vector<std::string> DeathMessage30 = {
140                "Getting better!",
141                "Training has paid off, huh?",
142                "Good average!",
143                "That was somehow enjoyable to watch",
144                "Flappin average",
145                "Getting closer to something",
146                "That wasn't crap, not bad"};
147            std::vector<std::string> DeathMessage50 = {
148                "Flappin great",
149                "Good job!",
150                "Okay, we give you a shiny medal, not a golden one, tough",
151                "Maybe you should do that professionally",
152                "That was really good,!",
153                "We are proud of you"};
154            std::vector<std::string> DeathMessageover50 = {
155                "You're flappin amazing",
156                "Fucking great job",
157                "Wow, we're really impressed",
158                "We will honor you!",
159                "Please do that again!",
160                "Take that golden medal! You've earned it"};
161           
162
163
164
165    };
166}
167
168#endif /* _FlappyOrx_H__ */
Note: See TracBrowser for help on using the repository browser.