diff options
author | Nikolas <nikolas@boutalas.com> | 2024-10-27 12:52:55 +0200 |
---|---|---|
committer | Nikolas <nikolas@boutalas.com> | 2024-10-27 12:52:55 +0200 |
commit | 43394c8a8908442982e3a7e25975c31b3c952923 (patch) | |
tree | 2facd563e29f48fe3b0653ac5c113998940b4d5e /src/explosion.cpp |
Diffstat (limited to 'src/explosion.cpp')
-rw-r--r-- | src/explosion.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
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 <iostream> + +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 |