0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 13:43:41 +00:00

player sprites look direction they shoot

This commit is contained in:
Benedikt Galbavy 2024-01-26 23:36:53 +01:00
parent 96418442f0
commit d9f3b5ceba

View File

@ -57,10 +57,12 @@ void KeyboardController::update()
//checks player source via the firing velocity //checks player source via the firing velocity
//TODO: adding actual projectile textures //TODO: adding actual projectile textures
if (fireVelocity.x > 0) { if (fireVelocity.x > 0) {
sprite->setDirection(RIGHT);
Game::assets->createProjectile(Vector2D(player->position.x, player->position.y), fireVelocity, Game::assets->createProjectile(Vector2D(player->position.x, player->position.y), fireVelocity,
false, 1, 180, 1, "assets/egg.png"); false, 1, 180, 1, "assets/egg.png");
} }
else { else {
sprite->setDirection(LEFT);
Game::assets->createProjectile(Vector2D(player->position.x, player->position.y), fireVelocity, Game::assets->createProjectile(Vector2D(player->position.x, player->position.y), fireVelocity,
true, 1, 180, 1, "assets/egg.png"); true, 1, 180, 1, "assets/egg.png");
} }