-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.h
67 lines (51 loc) · 1.15 KB
/
player.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
#ifndef PLAYER_H
#define PLAYER_H
#include <allegro5/allegro5.h>
#include <allegro5/allegro_image.h>
typedef struct
{
int x,y;
int width, height;
} box_t;
typedef struct
{
// input related:
unsigned char input_buffer[30];
int buffer_length;
long last_input_frame;
// sprite/animation related
int last_animation;
int current_animation;
int wanted_animation;
int animation_sprite_id;
int animation_frame;
ALLEGRO_BITMAP* sprite;
int paused_frames;
// game state related
int health;
int x;
bool is_player1;
bool is_neutral;
bool is_standing;
bool is_inputting_block;
bool is_KOd;
bool is_godmode;
int rounds_won;
box_t main_hurtbox;
box_t move_hurtbox;
box_t hitbox;
bool hitbox_is_active;
} player;
#include "animation.h"
#include "utils.h"
#include "display.h"
#include "logic.h"
#define PLAYER_SPEED 3 // character speed
#define PLAYER_HEIGHT 70
void init_players(player* p1, player* p2);
bool is_blocking(enum animation a);
bool is_hitstun(enum animation a);
bool is_neutral(enum animation a);
bool is_standing(player* p);
int middle_x(player p);
#endif