From 56ccdfb1fdf4f1d9370deac0eee8a6bcf9ffaee1 Mon Sep 17 00:00:00 2001 From: Andreas Ortmann Date: Tue, 27 Sep 2016 19:26:16 +0200 Subject: [PATCH] adding explosion stuff, adding trace file. --- game/state/explosion.hpp | 23 +++++++++++++++++------ game/state/trace.cpp | 0 game/state/trace.hpp | 0 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 game/state/trace.cpp create mode 100644 game/state/trace.hpp diff --git a/game/state/explosion.hpp b/game/state/explosion.hpp index 2cf92ef..9a37296 100644 --- a/game/state/explosion.hpp +++ b/game/state/explosion.hpp @@ -1,17 +1,28 @@ #pragma once -#if 0 +/** + * Explosion: just an effect which looks good. + */ class Explosion { public: enum class Kind { - Normal, - MissileWithShip + MissileExplodesInSpace, // missile explode in free space + MissileAgainstPlanet, // explosion of missile when it hits a planet + MissileAgainstShip // bigger explosion: missile hits a ship which explodes with it }; - glm::vec2 position; + Explosion(const glm::vec2 &pos, Kind kind, float maxAge=1.0) + : position(pos), kind(kind), age(0.0), maxAge(maxAge) + { + } - Explosion(Kind kind); + const Kind kind; // kind of the explosion + const glm::vec2 position; // position where it starts + float age; // age (in seconsd) of the explosion -public: + // age (in seconds) when the explosion is not visible + // anymore and will disappear afterwards + const float maxAge; }; + #endif diff --git a/game/state/trace.cpp b/game/state/trace.cpp new file mode 100644 index 0000000..e69de29 diff --git a/game/state/trace.hpp b/game/state/trace.hpp new file mode 100644 index 0000000..e69de29