forked from CircusGames/Last_Resort
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModulePlayer.h
169 lines (123 loc) · 2.88 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#ifndef __MODULEPLAYER_H__
#define __MODULEPLAYER_H__
#include "Module.h"
#include "Animation.h"
//#include "Globals.h"
#include "p2Point.h"
#include "SDL\include\SDL_events.h"
#include "ModulePlayer.h"
//#include "Player1.h"
struct SDL_Texture;
struct Collider;
struct Mix_Chunk;
enum player_state
{
spawn,
normal,
died
};//player_step = player_state::spawn;
class ModulePlayer : public Module
{
public:
player_state player_step = player_state::spawn;
/*enum player_state
{
spawn,
normal,
died
}player_step = player_state::spawn;*/
/*enum player_powerUps
{
BOOST,
BOMB,
MISSILE,
};*/
public:
ModulePlayer();
~ModulePlayer();
//bool Init();
bool Start();
update_status PreUpdate();
update_status Update();
bool CleanUp();
void OnCollision(Collider* collider1, Collider* collider2);
void deathLogic();
virtual void checkInput() {};
public:
SDL_Texture* player = nullptr;
SDL_Texture* playerEffectsTexture = nullptr;
Animation idle;
iPoint position;
Animation* current_animation = nullptr;
Animation playerAnim;
Animation spawnAnim;
int pivotsSpawnX[14] = {40,30,30,28,28,28,24,24,30,30,25,24,4,0};
Animation playerDyingAnim;
Animation beamSmoke;
Animation boostAnim;
Animation laserFlash;
SDL_Texture* laserFlashTexture = nullptr;
bool shooting = false;
bool shootingLaser = false;
float frameIncrement;
float ignitionSpeed;
float releaseSpeed;
float playerSpeed; //actual playerSpeed
float speed; // for movement and powerup calculations
const float normalPlayerSpeed = 1.4f;
const float boostPlayerSpeed = 2.0f;
const float brakePlayerSpeed = 0.9f;
Collider* playerCollider = nullptr;
bool godMode = false;
int cameraPosition;
int lives = 3;
int playerScore = 0;
bool destroyed = false;
//condition of the powerup call ---
powerUpTypes powerUpActive;
SDL_Texture* powerUpTextures = nullptr;
struct activeBuff
{
bool boost = false;
bool boostAnim = false;
bool bombs = false;
bool missiles = false;
bool brake = false;
bool laser = false;
} activebuff;
//time counter variables
Uint32 start_time;
Uint32 now;
Uint32 powerUpTime;
bool click = false;
Module* sceneCallback = nullptr;
//public heritance for two players functionality
struct playerInput
{
bool moveLeft = false;
bool moveRight = false;
bool moveUp = false;
bool moveDown = false;
bool shot = false;
bool lockUnit = false;
bool coins = false;
bool chargedShot = false;
bool chargedShotGamepad = false;
}playerInput;
SDL_Texture* playerTexture = nullptr;
int playerIndex;
Uint32 start_missile_time;
Uint32 now_missile_time;
Uint32 cadence_missile = 500;
bool shootedMissile = false;
Uint32 start_bombs_time;
Uint32 now_bombs_time;
Uint32 cadence_bombs = 500;
bool shootedBombs = false;
Uint32 start_laser_time;
Uint32 now_laser_time;
Uint32 cadence_laser = 300;
bool laserShoot = false;
bool scoreReset = true;
};
#endif