-
Notifications
You must be signed in to change notification settings - Fork 1
/
Player.h
47 lines (34 loc) · 880 Bytes
/
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
#ifndef _PLAYER_H_
#define _PLAYER_H_
#include <SDL2/SDL.h>
#include <vector>
#include "Inventory.h"
class Inventory;
class Tile;
class Player {
public:
// unique player ID
unsigned int id;
// health
unsigned int health;
SDL_Rect frame[4][2];
int last_frame;
// player's coordinates on the board
SDL_Rect coord;
// the original image whence we will extract the player
SDL_Surface* image;
SDL_Surface* basic_player;
SDL_Surface* armored_player;
// player's position within the image
SDL_Rect position;
unsigned int invulnerable;
Inventory inventory;
Player();
// the player will be moved towards the new coordinates
void move(SDL_Rect& direction, SDL_Surface* screen);
void draw(SDL_Surface* screen);
void pick(Tile*& tile);
void equip_armor(bool value);
~Player();
};
#endif