From 7b1a357998c77fc5c4aec9f2e15cfc69a7bded92 Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Mon, 29 May 2023 00:22:36 +0200 Subject: [PATCH] Extracted speed property --- src/game/player/player.cpp | 2 +- src/game/player/player.hpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/player/player.cpp b/src/game/player/player.cpp index 6e695a1..375ed87 100644 --- a/src/game/player/player.cpp +++ b/src/game/player/player.cpp @@ -22,7 +22,7 @@ void Player::update() } auto moveDirection = input->direction.asIsometricVector(); - auto moveDelta = moveDirection * 30.0f * FRAME_TIME.asSeconds(); + auto moveDelta = moveDirection * speed * FRAME_TIME.asSeconds(); coordinates.move(moveDelta); circle->coordinates.set(coordinates); } diff --git a/src/game/player/player.hpp b/src/game/player/player.hpp index ff7d9c6..7743252 100644 --- a/src/game/player/player.hpp +++ b/src/game/player/player.hpp @@ -22,6 +22,8 @@ public: TrackableState getTrackableState() const override; + float speed = 30.0f; + private: CircleObject *circle; std::shared_ptr input;