[3471] | 1 | /*! |
---|
| 2 | \file player.h |
---|
| 3 | \brief Implements a basic controllable WorldEntity |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _PLAYER_H |
---|
| 7 | #define _PLAYER_H |
---|
| 8 | |
---|
| 9 | #include "world_entity.h" |
---|
| 10 | |
---|
[3583] | 11 | template<class T> class tList; |
---|
| 12 | class Weapon; |
---|
[3608] | 13 | class Vector; |
---|
[3620] | 14 | class World; |
---|
[3471] | 15 | |
---|
| 16 | //! Basic controllable WorldEntity |
---|
| 17 | class Player : public WorldEntity |
---|
| 18 | { |
---|
| 19 | friend class World; |
---|
| 20 | |
---|
| 21 | public: |
---|
[3620] | 22 | Player(); |
---|
[3531] | 23 | virtual ~Player(); |
---|
[3583] | 24 | |
---|
| 25 | void addWeapon(Weapon* weapon); |
---|
| 26 | void removeWeapon(Weapon* weapon); |
---|
[3471] | 27 | |
---|
| 28 | virtual void postSpawn(); |
---|
[3583] | 29 | virtual void leftWorld(); |
---|
[3578] | 30 | virtual void hit(WorldEntity* weapon, Vector* loc); |
---|
[3471] | 31 | virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); |
---|
[3583] | 32 | |
---|
| 33 | virtual void tick(float time); |
---|
| 34 | virtual void draw(); |
---|
| 35 | |
---|
[3471] | 36 | virtual void command(Command* cmd); |
---|
| 37 | |
---|
| 38 | private: |
---|
| 39 | bool bUp; //!< up button pressed. |
---|
| 40 | bool bDown; //!< down button pressed. |
---|
| 41 | bool bLeft; //!< left button pressed. |
---|
| 42 | bool bRight; //!< right button pressed. |
---|
| 43 | bool bAscend; //!< ascend button pressed. |
---|
| 44 | bool bDescend; //!< descend button presses. |
---|
| 45 | bool bFire; //!< fire button pressed. |
---|
[3585] | 46 | bool bWeaponChange; //!< weapon change button pressed |
---|
[3471] | 47 | |
---|
[3583] | 48 | tList<Weapon>* weapons;//!< a list of weapon |
---|
[3585] | 49 | Weapon* activeWeapon; //!< the weapon that is currenty activated |
---|
[3620] | 50 | World* myWorld; //!< reference to the world object |
---|
[3583] | 51 | |
---|
[3608] | 52 | Vector* velocity; //!< the velocity of the player. |
---|
[3471] | 53 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
| 54 | float acceleration; //!< the acceleration of the player. |
---|
| 55 | |
---|
| 56 | void move(float time); |
---|
[3620] | 57 | void weapon(void); |
---|
[3471] | 58 | |
---|
| 59 | }; |
---|
| 60 | |
---|
| 61 | #endif /* _PLAYER_H */ |
---|