diff --git a/src/samples/dolphin/objects/mine.cpp b/src/samples/dolphin/objects/mine.cpp new file mode 100644 index 0000000..aff4140 --- /dev/null +++ b/src/samples/dolphin/objects/mine.cpp @@ -0,0 +1,35 @@ +/* +# ______ ____ ___ +# | \/ ____| |___| +# | | | \ | | +#----------------------------------------------------------------------- +# Copyright 2020, tyra - https://github.com/h4570/tyra +# Licenced under Apache License 2.0 +# Michał Mostowik +*/ + +#include "mine.hpp" + +u8 Mine::lastSoundBuffer = 4; + +Mine::Mine() +{ + //mesh.loadObj("mine/", "mine", 10.F, false); + mesh.position.set(0.0F, 0.0F, 0.0F); + + bExploding = false; + explosionTicks = 0; +} + +Mine::~Mine() +{ +} + +void Mine::update() +{ + if (bExploding && explosionTicks < MINE_EXPLOSION_TICKS) + { + explosionTicks++; + mesh.scale++; + } +} \ No newline at end of file diff --git a/src/samples/dolphin/objects/mine.hpp b/src/samples/dolphin/objects/mine.hpp new file mode 100644 index 0000000..5dce106 --- /dev/null +++ b/src/samples/dolphin/objects/mine.hpp @@ -0,0 +1,35 @@ +/* +# ______ ____ ___ +# | \/ ____| |___| +# | | | \ | | +#----------------------------------------------------------------------- +# Copyright 2020, tyra - https://github.com/h4570/tyra +# Licenced under Apache License 2.0 +# Michał Mostowik +*/ + +#ifndef _MINE_ +#define _MINE_ + +#include +#include + +#define MINE_EXPLOSION_TICKS 10 + +class Mine +{ +public: + static u8 lastSoundBuffer; + Mesh mesh; + void explode() { bExploding = true; } + void update(); + Mine(); + ~Mine(); + const u8 &getExplosionTicks() { return explosionTicks; } + +private: + u8 bExploding; + u8 explosionTicks; +}; + +#endif