This repository has been archived by the owner on Mar 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
81 lines (68 loc) · 1.81 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef PLAYER_H_INCLUDED
#define PLAYER_H_INCLUDED
// Touches Clavier J1
#define J1_UP SDLK_w
#define J1_RIGHT SDLK_d
#define J1_LEFT SDLK_a
#define J1_ATTACK SDLK_SPACE
#define J1_SHIELD SDLK_q
#define J1_SMASH SDLK_LALT
// Touches Clavier J2
#define J2_UP SDLK_UP
#define J2_RIGHT SDLK_RIGHT
#define J2_LEFT SDLK_LEFT
#define J2_ATTACK SDLK_KP0
#define J2_SHIELD SDLK_KP3
#define J2_SMASH SDLK_KP_ENTER
// Constante de combat
#define BIG_ATTACK 9
#define FALL_SPEED 8
#define JUMP_SPEED 16
#define TIME_BEFORE_LITTLE_HIT 24
#define TIME_SHIELD 150
#include <stdbool.h>
// Type Player
typedef struct {
SDL_Surface *surface;
SDL_Surface *icone;
SDL_Rect hitbox;
int num; // numero
int type; // 1 si joueur, 2 si IA
int h;
int jump;
int speed;
int up;
int right;
int left;
int attack;
int smash;
bool shield;
int hp;
int hpMax;
int canAttack;
int bufferSmash;
int estPropulse;
int forcePropulsion;
int sensPropulsion;
int timeBeforeLittleHit;
int life;
bool surSol;
int timeShield;
bool stun;
int points;
// STATS
int victory;
int defeat;
int big_hit;
int distance_travelled;
} Player;
// Collisions
bool colide (SDL_Rect obj, SDL_Rect* oth, int n);
bool colidePlayers (Player *p1, Player *p2);
// Deplacements
void moving(Player* p, SDL_Rect* obstacles, int n);
// Combats
void hit(Player *p1, Player *p2);
// Creation de joueur
Player newPlayer(int num, SDL_Surface *surface, SDL_Rect hitbox, int type);
#endif // PLAYER_H_INCLUDED