1 | /*! |
---|
2 | * @file space_ship.h |
---|
3 | * Implements the Control of a Spaceship |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _SPACE_SHIP_H |
---|
7 | #define _SPACE_SHIP_H |
---|
8 | |
---|
9 | #include "playable.h" |
---|
10 | |
---|
11 | template<class T> class tList; |
---|
12 | class Vector; |
---|
13 | class Event; |
---|
14 | |
---|
15 | class SpaceShip : public Playable |
---|
16 | { |
---|
17 | |
---|
18 | public: |
---|
19 | |
---|
20 | SpaceShip(); |
---|
21 | SpaceShip(const char* fileName); |
---|
22 | SpaceShip(const TiXmlElement* root); |
---|
23 | virtual ~SpaceShip(); |
---|
24 | |
---|
25 | void init(); |
---|
26 | void loadParams(const TiXmlElement* root); |
---|
27 | |
---|
28 | void addWeapon(Weapon* weapon ); |
---|
29 | void removeWeapon(Weapon* weapon); |
---|
30 | |
---|
31 | virtual void postSpawn(); |
---|
32 | virtual void leftWorld(); |
---|
33 | |
---|
34 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
35 | virtual void tick(float time); |
---|
36 | virtual void draw() const; |
---|
37 | |
---|
38 | virtual void process(const Event &event); |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | private: |
---|
43 | |
---|
44 | void calculateVelocity(float time); |
---|
45 | void weaponAction(); |
---|
46 | |
---|
47 | // !! temporary !! |
---|
48 | void ADDWEAPON(); |
---|
49 | |
---|
50 | bool bUp; //!< up button pressed. |
---|
51 | bool bDown; //!< down button pressed. |
---|
52 | bool bLeft; //!< left button pressed. |
---|
53 | bool bRight; //!< right button pressed. |
---|
54 | bool bAscend; //!< ascend button pressed. |
---|
55 | bool bDescend; //!< descend button presses. |
---|
56 | bool bFire; //!< fire button pressed. |
---|
57 | |
---|
58 | Vector velocity; //!< the velocity of the player. |
---|
59 | Vector velocityDir; //!< the direction of the velocity of the spaceship |
---|
60 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
61 | float acceleration; //!< the acceleration of the player. |
---|
62 | |
---|
63 | }; |
---|
64 | |
---|
65 | #endif /* _SPACE_SHIPS_H */ |
---|