-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModuleParticles.h
101 lines (75 loc) · 2.12 KB
/
ModuleParticles.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
#ifndef __MODULEPARTICLES_H__
#define __MODULEPARTICLES_H__
#include "Module.h"
#include "Animation.h"
#include "Globals.h"
#include "p2Point.h"
#include "ModuleCollision.h"
#define MAX_ACTIVE_PARTICLES 500
struct SDL_Texture;
struct Collider;
enum COLLIDER_TYPE;
struct Particle
{
Collider* collider = nullptr;
Animation anim;
SDL_Texture* texture = nullptr;
char* fx = nullptr;
iPoint position;
iPoint impactPosition = { NULL,NULL };
//bool impactPositioning = false;
iPoint speed;
Uint32 born = 0;
Uint32 life = 0;
Uint32 damage = 0;
bool fx_played = false;
Particle();
Particle(const Particle& p);
~Particle();
bool Update();
// variables to instantiate collision particle
Particle* onCollisionWallParticle = nullptr;
Particle* onCollisionGeneralParticle = nullptr;
Particle* deathParticle = nullptr;
};
class ModuleParticles : public Module
{
public:
ModuleParticles();
~ModuleParticles();
bool Start();
update_status Update();
bool CleanUp();
void OnCollision(Collider* c1, Collider* c2);
//void AddParticle(const Particle& particle, Animation& sourceAnim, int x, int y, Uint32 delay = 0, iPoint speed = { 0,0 }, Uint32 life = 0, char* fx = nullptr);
void AddParticle(const Particle& particle, int x, int y, COLLIDER_TYPE collider_type, iPoint speed = {0,0}, Uint32 delay = 0);
private:
SDL_Texture* graphics = nullptr;
SDL_Texture* unitBasicShotTexture = nullptr;
SDL_Texture* laserTexture = nullptr;
SDL_Texture* beamImpactTexture = nullptr;
SDL_Texture* unitBasicShotImpactTexture = nullptr;
SDL_Texture* powerUpVFXTexture = nullptr;
Particle* active[MAX_ACTIVE_PARTICLES];
SDL_Texture* test = nullptr;
public:
//Particle explosion;
//Player particles --------------------
//basic shot -------------
Particle beam;
Particle beamImpactParticle;
//Particle beamSmoke;
//Unit basic shot ---------
Particle unitBasicShot;
Particle unitBasicShotImpact;
Particle explosion;
Particle laser;
Particle homingMissile;
Particle bombsUp;
Particle bombsDown;
Particle bombGoodBye;
Particle laserRing;
Particle laserRingImpact;
// enemy goodbye particle
};
#endif // __MODULEPARTICLES_H__