Commit | Line | Data |
---|---|---|
ad9f1fb6 PG |
1 | #include "Particle.h" |
2 | #include "../Vector2.h" | |
3 | ||
4 | /// ***** Public Class Methods ***** | |
5 | Particle::Particle(Vector2 pos, bool canDie) | |
6 | : Entity(pos), canDie(canDie) | |
7 | { | |
8 | ||
9 | } | |
10 | Particle::Particle(Vector2 pos, float lifeTime) | |
11 | : Entity(pos), lifeTime(lifeTime) | |
12 | { | |
13 | ||
14 | } | |
15 | Particle::~Particle() | |
16 | { | |
17 | ||
18 | } | |
19 | ||
20 | void Particle::update(float time_step) | |
21 | { | |
22 | if(isDead) | |
23 | return; | |
24 | ||
25 | if (canDie) | |
26 | { | |
27 | lifeTime -= time_step; | |
28 | isDead = lifeTime <= 0; | |
29 | } | |
30 | position += velocity * time_step; | |
31 | } |