Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickupsFS14/src/modules/jump/Jump.h @ 10075

Last change on this file since 10075 was 10074, checked in by fvultier, 10 years ago

new items added. improved level generator.

File size: 7.9 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 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file Jump.h
31    @brief Declaration of the Jump class.
32    @ingroup Jump
33*/
34
35#ifndef _Jump_H__
36#define _Jump_H__
37
38#include "jump/JumpPrereqs.h"
39
40#include "tools/Timer.h"
41#include "graphics/Camera.h"
42
43#include "gametypes/Deathmatch.h"
44#include "JumpCenterpoint.h"
45
46#include <list>
47
48namespace orxonox
49{
50
51    /**
52    @brief
53        Implements a Jump minigame (<a href="http://en.wikipedia.org/wiki/Jump">Wikipedia::Jump</a>).
54        It connects the different entities present in a game of Jump.
55
56        - The @ref orxonox::JumpCenterpoint "JumpCenterpoint" is the playing field for the Jump minigame, it allows for configuration of the minigame, e.g. by setting the size of the playing field, or the length of the @ref orxonox::JumpFigure "JumpFigures". The playing field is always in the x,y-plane, the x-axis being the horizontal and the z-axis being the vertical axis.<br />
57        The Jump class redistributes the important parameters defined in @ref orxonox::JumpCenterpoint "JumpCenterpoint" to the other entities, that need to know them, e.g. the @ref orxonox::JumpPlatform "JumpPlatform" and the @ref orxonox::JumpFigure "JumpFigures".<br />
58        The @ref orxonox::JumpCenterpoint "JumpCenterpoint" needs to exist in a level with the @ref orxonox::Gametype "Gametype" <em>Jump</em>.
59        - The @ref orxonox::JumpPlatform "JumpPlatform" is the ball both players play with. The @ref orxonox::JumpPlatform "JumpPlatform" both implements the movement of the ball, as well as the influence of the boundaries and consequently, also the bouncing (off the upper and lower delimiters, and as off the @ref orxonox::JumpFigure "JumpFigures") of the ball and the effects of the failure of a player to catch the ball (i.e. the scoring of the other player).
60        - The two @ref orxonox::JumpFigure "JumpFigures" are the entities through which the players can actively participate in the game, by controlling them. The @ref orxonox::JumpFigure "JumpFigure" class manages the movement (and restrictions thereof) and the influence of the players on the bats.
61
62    @author
63        Fabian 'x3n' Landau
64
65    @ingroup Jump
66    */
67    class _JumpExport Jump : public Deathmatch
68    {
69        public:
70            Jump(Context* context); //!< Constructor. Registers and initializes the object.
71            virtual ~Jump(); //!< Destructor. Cleans up, if initialized.
72
73            virtual void tick(float dt);
74
75            virtual void start(); //!< Starts the Jump minigame.
76            virtual void end(); ///!< Ends the Jump minigame.
77
78            virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player.
79
80            virtual void playerScored(PlayerInfo* player, int score = 1); //!< Is called when the player scored.
81
82            int getScore(PlayerInfo* player) const;
83            bool getDead(PlayerInfo* player) const;
84
85            /**
86            @brief Set the JumpCenterpoint (the playing field).
87            @param center A pointer to the JumpCenterpoint to be set.
88            */
89            void setCenterpoint(JumpCenterpoint* center)
90                { center_ = center; }
91            void setConfigValues(); //!< Makes scoreLimit configurable.
92
93            PlayerInfo* getPlayer() const; //!< Get the left player.
94
95        protected:
96            void startBall(); //!< Starts the ball with some default speed.
97            void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats.
98
99            virtual void addPlatform(JumpPlatform* newPlatform, std::string platformTemplate, float xPosition, float zPosition);
100
101            virtual JumpPlatformStatic* addPlatformStatic(float xPosition, float zPosition);
102            virtual JumpPlatformHMove* addPlatformHMove(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float speed);
103            virtual JumpPlatformVMove* addPlatformVMove(float xPosition, float zPosition, float lowerBoundary, float upperBoundary, float speed);
104            virtual JumpPlatformDisappear* addPlatformDisappear(float xPosition, float zPosition);
105            virtual JumpPlatformTimer* addPlatformTimer(float xPosition, float zPosition, float time, float variance);
106            virtual JumpPlatformFake* addPlatformFake(float xPosition, float zPosition);
107            virtual void addProjectile(float xPosition, float zPosition);
108            virtual void addEnemy(int type, float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
109            virtual void addSpring(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
110            virtual void addSpring(JumpPlatform* platform);
111            virtual void addRocket(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
112            virtual void addRocket(JumpPlatform* platform);
113            virtual void addPropeller(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
114            virtual void addPropeller(JumpPlatform* platform);
115            virtual void addBoots(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
116            virtual void addBoots(JumpPlatform* platform);
117            virtual void addShield(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
118            virtual void addShield(JumpPlatform* platform);
119
120            virtual void addStartSection();
121            virtual void addSection();
122            virtual bool addAdventure(int number);
123
124            virtual float randomXPosition();
125            virtual float randomXPosition(int totalColumns, int culomn);
126            virtual float randomXPositionLeft(int totalColumns, int culomn);
127            virtual float randomXPositionRight(int totalColumns, int culomn);
128            virtual float randomZPosition(int totalRows, int row, float sectionBegin, float SectionEnd);
129            virtual float randomZPositionLower(int totalRows, int row, float sectionBegin, float SectionEnd);
130            virtual float randomZPositionUpper(int totalRows, int row, float sectionBegin, float SectionEnd);
131
132            virtual float randomPosition(float lowerBoundary, float upperBoundary);
133            virtual float randomSpeed();
134
135            WeakPtr<JumpCenterpoint> center_; //!< The playing field.
136            WeakPtr<JumpFigure> figure_; //!< The two bats.
137            WeakPtr<Camera> camera;
138            int scoreLimit_; //!< If a player scored that much points, the game is ended.
139
140            float totalScreenShift;
141            float screenShiftSinceLastUpdate;
142            int sectionNumber_;
143            int adventureNumber_;
144            float platformWidth_;
145            float platformHeight_;
146    };
147}
148
149#endif /* _Jump_H__ */
Note: See TracBrowser for help on using the repository browser.