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