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