-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathActor.h
More file actions
70 lines (49 loc) · 1.87 KB
/
Actor.h
File metadata and controls
70 lines (49 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*******************************************************************************
CommanderTux
Penguin In Space
Released under the GNU Public License
2005 by André Schnabel (thefrogs@web.de)
*******************************************************************************/
// Actor.h
#ifndef ACTOR_H
#define ACTOR_H
#include "Sprite.h"
#include "SLevel.h"
// Anything concerning to the level should derive from this class
class CActor : public CSprite
{
public:
CActor( int s_x, int s_y,
SLevel *level,
SDL_Texture *images[NUM_ACTOR_IMAGES],
int fall_speed );
bool GetDying();
virtual void Die();
virtual void Respawn();
virtual void Walk( Direction dir=DIR_LEFT, int walk_speed = WALK_SPEED );
bool WalkPossible( Direction dir );
virtual void Jump();
virtual void StopJump( bool bump );
void IncreaseJump( bool ignore_max = false );
virtual void Update( int *scroll_x, int *scroll_y, bool enemy );
bool GetFalling() { return m_fall.active; }
void SetFalling( bool value ) { m_fall.active = value; }
bool GetStanding() { return m_standing; }
void SetStanding( bool value ) { m_standing = value; }
void SetDirection( Direction dir ) { m_dir = dir; }
Direction GetDirection() { return m_dir; }
bool IsJumping() { return m_jump.active; }
protected:
int m_s_x, m_s_y;
SDL_Texture *m_images[NUM_ACTOR_IMAGES];
Direction m_dir;
SLevel *m_level;
bool m_flip;
Uint32 m_last_flip;
int m_fall_speed;
Gravity_Event m_jump, m_fall;
unsigned int m_jump_increase;
bool m_reset_image;
bool m_standing, m_dying;
};
#endif