blob: 3254b5be195d947750df7712da1c5826ee94eb6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include "Particle.hpp"
#include <iostream>
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 += velocity.x * deltaTime;
position.y += velocity.y * deltaTime;
}
bool Particle::isAlive() const {
std::cout << "lifespan" << lifespan << std::endl;
return timeInLife < lifespan;
}
|