Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/pong/PongBat.h @ 8917

Last change on this file since 8917 was 8706, checked in by dafrick, 13 years ago

Merging presentation branch back into trunk.
There are many new features and also a lot of other changes and bugfixes, if you want to know, digg through the svn log.
Not everything is yet working as it should, but it should be fairly stable. If you habe any bug reports, just send me an email.

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