From d9f3b5cebad5db082a45cef1aa9ed00ee5a5b45e Mon Sep 17 00:00:00 2001 From: Benedikt Galbavy Date: Fri, 26 Jan 2024 23:36:53 +0100 Subject: [PATCH] player sprites look direction they shoot --- src/KeyboardController.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/KeyboardController.cpp b/src/KeyboardController.cpp index 9050784..2880fe0 100644 --- a/src/KeyboardController.cpp +++ b/src/KeyboardController.cpp @@ -57,10 +57,12 @@ void KeyboardController::update() //checks player source via the firing velocity //TODO: adding actual projectile textures if (fireVelocity.x > 0) { + sprite->setDirection(RIGHT); Game::assets->createProjectile(Vector2D(player->position.x, player->position.y), fireVelocity, false, 1, 180, 1, "assets/egg.png"); } else { + sprite->setDirection(LEFT); Game::assets->createProjectile(Vector2D(player->position.x, player->position.y), fireVelocity, true, 1, 180, 1, "assets/egg.png"); }