From 43394c8a8908442982e3a7e25975c31b3c952923 Mon Sep 17 00:00:00 2001 From: Nikolas Date: Sun, 27 Oct 2024 12:52:55 +0200 Subject: root --- src/shot.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/shot.cpp (limited to 'src/shot.cpp') 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 -- cgit v1.2.3