Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 17, 2014, 4:29:25 PM (11 years ago)
Author:
fvultier
Message:

Bewegung mit WASD und Absprung von einer Platform in der Mitte funktioniert.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickupsFS14/src/modules/jump/Jump.h

    r10032 r10040  
    2121 *
    2222 *   Author:
    23  *      Florian Zinggeler
     23 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    2525 *      ...
     
    2929/**
    3030    @file Jump.h
    31     @brief Gametype.
     31    @brief Declaration of the Jump class.
    3232    @ingroup Jump
    3333*/
     
    3737
    3838#include "jump/JumpPrereqs.h"
     39
     40#include "tools/Timer.h"
     41#include "graphics/Camera.h"
     42
    3943#include "gametypes/Deathmatch.h"
    40 #include "JumpCenterPoint.h"
    41 #include "tools/Timer.h"
    42 #include "JumpPlatform.h"
    43 #include <list>
    44 
     44#include "JumpCenterpoint.h"
    4545
    4646namespace orxonox
    4747{
    4848
     49    /**
     50    @brief
     51        Implements a Jump minigame (<a href="http://en.wikipedia.org/wiki/Jump">Wikipedia::Jump</a>).
     52        It connects the different entities present in a game of Jump.
     53
     54        - 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 />
     55        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 />
     56        The @ref orxonox::JumpCenterpoint "JumpCenterpoint" needs to exist in a level with the @ref orxonox::Gametype "Gametype" <em>Jump</em>.
     57        - 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).
     58        - 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.
     59
     60    @author
     61        Fabian 'x3n' Landau
     62
     63    @ingroup Jump
     64    */
    4965    class _JumpExport Jump : public Deathmatch
    5066    {
    5167        public:
    52             Jump(Context* context);
    53             virtual void start();
    54             //virtual void end();
    55             //virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command
     68            Jump(Context* context); //!< Constructor. Registers and initializes the object.
     69            virtual ~Jump(); //!< Destructor. Cleans up, if initialized.
    5670
    5771            virtual void tick(float dt);
    5872
    59             //void spawnEnemy();
     73            virtual void start(); //!< Starts the Jump minigame.
     74            virtual void end(); ///!< Ends the Jump minigame.
    6075
    61             void setCenterpoint(JumpCenterPoint* center){ this->center_ = center; }
     76            virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player.
    6277
    63             virtual void addPlatform(float x, float y);
     78            virtual void playerScored(PlayerInfo* player, int score = 1); //!< Is called when the player scored.
    6479
    65            /*int getLives(){return this->lives;}
    66             int getLevel(){return this->level;}
    67             int getPoints(){return this->point;}
    68             int getMultiplier(){return this->multiplier;}*/
     80            /**
     81            @brief Set the JumpCenterpoint (the playing field).
     82            @param center A pointer to the JumpCenterpoint to be set.
     83            */
     84            void setCenterpoint(JumpCenterpoint* center)
     85                { this->center_ = center; }
     86            void setConfigValues(); //!< Makes scoreLimit configurable.
    6987
    70             /*void costLife();
    71             void levelUp();
    72             void addPoints(int numPoints);
    73             // checks if multiplier should be reset.
    74             void comboControll();*/
    75             //int lives;
    76             //int multiplier;
    77             //bool bEndGame;
    78             //bool bShowLevel;
    79         private:
    80             //void toggleShowLevel(){bShowLevel = !bShowLevel;}
    81             WeakPtr<JumpShip> getPlayer();
    82             WeakPtr<JumpCenterPoint> center_;
    83             WeakPtr<JumpShip> player;
     88            PlayerInfo* getPlayer() const; //!< Get the left player.
     89
     90        protected:
     91            virtual void spawnPlayersIfRequested(); //!< Spawns players, and fills the rest up with bots.
     92
     93            void startBall(); //!< Starts the ball with some default speed.
     94            void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats.
     95
     96            WeakPtr<JumpCenterpoint> center_; //!< The playing field.
     97            WeakPtr<JumpPlatform> ball_; //!< The Jump ball.
     98            WeakPtr<JumpFigure> figure_; //!< The two bats.
    8499            WeakPtr<Camera> camera;
     100            Timer starttimer_; //!< A timer to delay the start of the game.
     101            int scoreLimit_; //!< If a player scored that much points, the game is ended.
    85102
    86             /*Timer enemySpawnTimer;
    87             Timer comboTimer;
    88             Timer showLevelTimer;
    89             //Context* context; <-- War schon auskommentiert!!!
    90             int level;
    91             int point;
    92             bool b_combo;*/
    93             std::list<JumpPlatform*> platformList;
    94             float yScreenPosition;
    95             float screenShiftSinceLastUpdate;
     103            float totalScreenShift;
    96104    };
    97105}
Note: See TracChangeset for help on using the changeset viewer.