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/shot.cpp |
Diffstat (limited to 'src/shot.cpp')
-rw-r--r-- | src/shot.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/shot.cpp b/src/shot.cpp new file mode 100644 index 0000000..bbe7d42 --- /dev/null +++ b/src/shot.cpp @@ -0,0 +1,28 @@ +#include "shot.h" +#include "graphics.h" +#include "config.h" + +using namespace std; + +Shot::Shot(float pos_x, float pos_y, float size_x, float size_y, float orientation, string texture, float speed) : MovingGameObject(pos_x, pos_y, size_x, size_y, orientation, texture, speed){ + + graphics::playSound(string(ASSET_PATH) + this -> getTexture() + ".mp3", 0.5f, false); + +} + +Shot::~Shot(){ + +} + +void Shot::update(){ + + MovingGameObject::update(); + + float pos_y = this -> getPosY(); + float speed = this -> getSpeed(); + + pos_y -= speed * graphics::getDeltaTime(); + + this -> setPosY(pos_y); + +}
\ No newline at end of file |