From 43394c8a8908442982e3a7e25975c31b3c952923 Mon Sep 17 00:00:00 2001 From: Nikolas Date: Sun, 27 Oct 2024 12:52:55 +0200 Subject: root --- src/explosion.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/explosion.cpp (limited to 'src/explosion.cpp') diff --git a/src/explosion.cpp b/src/explosion.cpp new file mode 100644 index 0000000..f917c58 --- /dev/null +++ b/src/explosion.cpp @@ -0,0 +1,51 @@ +#include "explosion.h" +#include "graphics.h" +#include "gameobject.h" +#include "config.h" +#include + +using namespace std; + +Explosion::Explosion(float pos_x, float pos_y, float size_x, float size_y) : GameObject(pos_x, pos_y, size_x, size_y, 0.0f, "explosion1_"){ + + time = graphics::getGlobalTime(); + graphics::playSound(string(ASSET_PATH) + "explosion1_.mp3", 0.5f, false); + +} + +Explosion::~Explosion(){ + +} + +void Explosion::update(){ + + if(graphics::getGlobalTime() - time > 550){ + + this -> setTerminate(true); + + } +} + +void Explosion::draw(){ + + for(int i=1;i<12;++i){ + + if(graphics::getGlobalTime() - time > i * 50){ + + graphics::Brush br; + br.outline_opacity = 0.0f; + br.texture = string(ASSET_PATH) + this -> getTexture() + to_string(i) + ".png"; + + graphics::drawRect(this -> getPosX(), this -> getPosY(), this -> getSizeX(), this -> getSizeY(), br); + + } + + } + +} + +bool Explosion::collidable(){ + + return false; + +} \ No newline at end of file -- cgit v1.2.3