Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tetris/src/modules/pong/PongBat.h @ 8501

Last change on this file since 8501 was 8246, checked in by dafrick, 14 years ago

A place to start for tetris.

  • Property svn:eol-style set to native
File size: 4.2 KB
RevLine 
[2825]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
[8105]29/**
30    @file PongBat.h
31    @brief Declaration of the PongBat class.
32    @ingroup Pong
33*/
34
[2825]35#ifndef _PongBat_H__
36#define _PongBat_H__
37
[5725]38#include "pong/PongPrereqs.h"
[8105]39
[5735]40#include "worldentities/ControllableEntity.h"
[2825]41
42namespace orxonox
43{
[8105]44
45    /**
46    @brief
[8106]47        The PongBat class manages the bats for @ref orxonox::Pong "Pong", which are the elements controlled by the players.
48
[8105]49        It is responsible for the movement (controlled by the players) of the bat.
[8106]50
[8105]51    @author
52        Fabian 'x3n' Landau
[8106]53
[8105]54    @ingroup Pong
55    */
[5725]56    class _PongExport PongBat : public ControllableEntity
[2825]57    {
58        public:
[8105]59            PongBat(BaseObject* creator); //!< Constructor. Registers and initializes the object.
[2825]60            virtual ~PongBat() {}
61
62            virtual void tick(float dt);
63
[8105]64            virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
65            virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
[2825]66
[8105]67            virtual void changedPlayer(); //!< Is called when the player changed.
[2839]68
[8105]69            /**
70            @brief Set the speed of the bat.
71            @param speed The speed to be set.
72            */
[2825]73            void setSpeed(float speed)
74                { this->speed_ = speed; }
[8105]75            /**
76            @brief Get the speed of the bat.
77            @return Returns the speed of the bat.
78            */
[2825]79            float getSpeed() const
80                { return this->speed_; }
81
[8105]82            /**
83            @brief Set the height of the playing field.
84            @param height The height of the playing field.
85            */
[2825]86            void setFieldHeight(float height)
87                { this->fieldHeight_ = height; }
[8105]88            /**
89            @brief Get the height of the playing field.
90            @return Returns the height of the playing field.
91            */
[2825]92            float getFieldHeight() const
93                { return this->fieldHeight_; }
94
[8105]95            /**
96            @brief Set the length of the bat.
97            @param length The length of the bat (in z-direction) as percentage of the height of the playing field.
98            */
[2825]99            void setLength(float length)
100                { this->length_ = length; }
[8105]101            /**
[8246]102            @brief Get the length of the bat.
[8105]103            @return Returns the length of the bat (in z-direction) as percentage of the height of the playing field.
104            */
[2825]105            float getLength() const
106                { return this->length_; }
107
108        private:
[8105]109            void registerVariables(); //!< Registers variables to be synchronized over the network.
[7163]110
[8105]111            float movement_; //!< The amount (and direction), in z-direction, of movement of the bat.
[8106]112            bool bMoveLocal_; //!< Helper to know whether the movement is caused by moveFrontBack() or moveRightLeft().
113            float speed_; //!< The movement speed of the bat.
[8105]114            float length_; //!< The length of the bat (in z-direction) as percentage of the height of the playing field.
115            float fieldHeight_; //!< The height of the playing field.
[8106]116            bool bSteadiedPosition_; //!< Helper boolean, to keep track of when to steady the position, to ensure network synchronicity.
[2825]117    };
118}
119
120#endif /* _PongBat_H__ */
Note: See TracBrowser for help on using the repository browser.