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