diff options
author | jaroWMR <jarorutjes07@gmail.com> | 2024-10-01 19:10:24 +0200 |
---|---|---|
committer | jaroWMR <jarorutjes07@gmail.com> | 2024-10-01 19:10:24 +0200 |
commit | bd24f87e18bef29679023ee9a60028f2afdbb470 (patch) | |
tree | aa17d05db8ba6d5f959e676aa2c51c67743108b3 /src/crepe/Particle.cpp | |
parent | a78f7bbfcdabad9550afe22f615b973b92cb074f (diff) |
particle POC
Diffstat (limited to 'src/crepe/Particle.cpp')
-rw-r--r-- | src/crepe/Particle.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/crepe/Particle.cpp b/src/crepe/Particle.cpp new file mode 100644 index 0000000..90957db --- /dev/null +++ b/src/crepe/Particle.cpp @@ -0,0 +1,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; +} |