-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModulePlayer.h
118 lines (93 loc) · 2.32 KB
/
ModulePlayer.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#pragma once
#ifndef __MODULEPLAYER_H__
#define __MODULEPLAYER_H__
#include "Module.h"
#include "p2Point.h"
#include "SDL_rect.h"
#include "Animation.h"
struct SDL_Texture;
class ModulePlayer : public Module {
public:
ModulePlayer(bool startEnabled);
~ModulePlayer();
bool Start();
bool Init();
update_status Update();
update_status PostUpdate();
bool CleanUp();
// The player's collider
Collider* collider = nullptr;
// Collision callback, called when the player intersects with another collider
void OnCollision(Collider* c1, Collider* c2) override;
// A flag to detect when the player has been destroyed
bool destroyed = false;
// Sound effects indices
uint shootFx = 0;
uint hitFx = 0;
uint dieFx = 0;
// Score
uint score = 0;
// Money
uint money = 3000;
// Total POW
uint total = 0;
// POW Level
uint level = 1;
bool maxAmmo = false;
bool maxPow = false;
iPoint GetPlayerPosition() {
return position;
}
int GetCurrentFuel() {
return currentFuel;
}
int GetMaxFuel() {
return maxFuel;
}
int GetLifes() {
return playerLifes;
}
// The whole list of weapons to know which one is the player selecting at each moment
enum weapons {
WEAPON_1, WEAPON_2, FALCON, WEAPON_4, SHELL, WEAPON_6,
BOMB, WEAPON_8, CEILING, WEAPON_10, WEAPON_11, NONE
};
// To know which is the current weapon (the last one that has been selected)
uint currentWeapon;
uint falconAmmo;
uint shellAmmo;
uint bombAmmo;
uint ceilingAmmo;
bool hasBeenHit;
uint hasBeenHitCounter;
private:
iPoint position;
SDL_Texture* texture = nullptr;
Animation* current_anim = nullptr;
Animation playerAnimRight;
Animation playerAnimLeft;
Animation playerSpinningRight;
Animation playerSpinningLeft;
SDL_Rect rectAnim;
int maxFuel = 8, currentFuel = 8, playerLifes = 3;
bool godMode = false;
uint weaponCount;
bool hasBought;
bool damaged = false;
int currentTime = 0;
// Countdown to handle shot spacing
int shotMaxCountdown = 13;
int shotCountdown = 0;
// Countdown to handle weapon shot spacing
int weaponMaxCountdown = 20;
int weaponCountdown = 0;
// Countdown to handle weapon change spacing
int changeMaxCountdown = 25;
int changeCountdown = 0;
// Ceiling countdown
uint ceilingCountdown;
uint collisionMaxCountdown = 30;
uint collisionCountdown = 0;
friend class ModuleLevel1;
};
#endif // __MODULEPLAYER_H__