-
Notifications
You must be signed in to change notification settings - Fork 0
/
cBicho.h
79 lines (61 loc) · 1.57 KB
/
cBicho.h
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
71
72
73
74
75
76
77
78
79
#pragma once
#include "cTexture.h"
#include "Globals.h"
#include "posTexture.h"
#include "cScene.h"
#define FRAME_DELAY 10
#define STEP_LENGTH 4
#define JUMP_HEIGHT 96
#define JUMP_STEP 4
#define STATE_LOOKLEFT 0
#define STATE_LOOKRIGHT 1
#define STATE_WALKUP 2
#define STATE_WALKDOWN 3
#define VELOCITAT_PLAYER 1
#define NUM_NAUS 5
#define NUM_STATES 5
class cRect
{
public:
int left,top,
right,bottom;
};
class cBicho
{
public:
cBicho(void);
cBicho(int x,int y,int w,int h);
~cBicho(void);
void SetPosition(int x,int y);
void GetPosition(int *x,int *y);
void SetTile(int tx,int ty);
void GetTile(int *tx,int *ty);
void SetWidthHeight(int w,int h);
void GetWidthHeight(int *w,int *h);
bool Collides(cRect *rc);
bool CollidesMapWall(int (*map)[SCENE_HEIGHT][SCENE_WIDTH], bool right);
bool CollidesMapFloor(int (*map)[SCENE_HEIGHT][SCENE_WIDTH], bool up);
void GetArea(cRect *rc);
void DrawRect(int tex_id, float xo, float yo, float xf, float yf);
bool MoveRight(int (*map)[SCENE_HEIGHT][SCENE_WIDTH]);
bool MoveLeft(int (*map)[SCENE_HEIGHT][SCENE_WIDTH]);
bool MoveUp(int (*map)[SCENE_HEIGHT][SCENE_WIDTH]);
bool MoveDown(int (*map)[SCENE_HEIGHT][SCENE_WIDTH]);
void Stop();
virtual void Shoot();
//void Logic(int *map);
int GetState();
void SetState(int s);
void NextFrame(int max);
int GetFrame();
protected:
int x,y;
int w,h;
int state;
bool jumping;
int jump_alfa;
int jump_y;
int seq,delay;
posTexture textSeq[NUM_NAUS][NUM_STATES];
bool stopUp, stopDown;
};