blob: 90957db8da70d9ba485b0f33375e7e0264e74232 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include "Particle.hpp"
Particle::Particle(float lifespan, Position position, Position velocity)
: lifespan(lifespan), position(position), velocity(velocity), timeInLife(0.0f) {}
void Particle::update(float deltaTime) {
timeInLife += deltaTime;
position.x += static_cast<int>(velocity.x * deltaTime);
position.y += static_cast<int>(velocity.y * deltaTime);
}
bool Particle::isAlive() const {
return timeInLife < lifespan;
}
|