diff options
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 |