diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-08-12 17:09:16 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-08-12 17:09:16 +0200 |
commit | 45de7d0537d2caec7d0a7ede48e2b72301bc9da9 (patch) | |
tree | af17dd093da09dc77a3a07a3d4835a1b5e5b85f6 /src/ThreadGame.cpp | |
parent | 2017-08-07 (diff) | |
download | AltCraft-45de7d0537d2caec7d0a7ede48e2b72301bc9da9.tar AltCraft-45de7d0537d2caec7d0a7ede48e2b72301bc9da9.tar.gz AltCraft-45de7d0537d2caec7d0a7ede48e2b72301bc9da9.tar.bz2 AltCraft-45de7d0537d2caec7d0a7ede48e2b72301bc9da9.tar.lz AltCraft-45de7d0537d2caec7d0a7ede48e2b72301bc9da9.tar.xz AltCraft-45de7d0537d2caec7d0a7ede48e2b72301bc9da9.tar.zst AltCraft-45de7d0537d2caec7d0a7ede48e2b72301bc9da9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ThreadGame.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/ThreadGame.cpp b/src/ThreadGame.cpp index 7bb3678..74802bb 100644 --- a/src/ThreadGame.cpp +++ b/src/ThreadGame.cpp @@ -39,11 +39,14 @@ void ThreadGame::Execute() { isMoving[GameState::LEFT] = true; break; case sf::Keyboard::S: - isMoving[GameState::BACKWARD] = true; - break; + isMoving[GameState::BACKWARD] = true; + break; case sf::Keyboard::D: - isMoving[GameState::RIGHT] = true; - break; + isMoving[GameState::RIGHT] = true; + break; + case sf::Keyboard::Space: + isMoving[GameState::JUMP] = true; + break; } }); @@ -63,6 +66,9 @@ void ThreadGame::Execute() { case sf::Keyboard::D: isMoving[GameState::RIGHT] = false; break; + case sf::Keyboard::Space: + isMoving[GameState::JUMP] = false; + break; } }); @@ -77,18 +83,20 @@ void ThreadGame::Execute() { while (isRunning) { if (gs != nullptr) - gs->Update(timer.GetDeltaS()); + gs->Update(timer.GetRealDeltaS()); listener.HandleEvent(); if (gs != nullptr) { gs->UpdatePacket(); if (isMoving[GameState::FORWARD]) - gs->HandleMovement(GameState::FORWARD, timer.GetDeltaS()); + gs->HandleMovement(GameState::FORWARD, timer.GetRealDeltaS()); if (isMoving[GameState::BACKWARD]) - gs->HandleMovement(GameState::BACKWARD, timer.GetDeltaS()); + gs->HandleMovement(GameState::BACKWARD, timer.GetRealDeltaS()); if (isMoving[GameState::LEFT]) - gs->HandleMovement(GameState::LEFT, timer.GetDeltaS()); + gs->HandleMovement(GameState::LEFT, timer.GetRealDeltaS()); if (isMoving[GameState::RIGHT]) - gs->HandleMovement(GameState::RIGHT, timer.GetDeltaS()); + gs->HandleMovement(GameState::RIGHT, timer.GetRealDeltaS()); + if (isMoving[GameState::JUMP]) + gs->HandleMovement(GameState::JUMP, timer.GetRealDeltaS()); } timer.Update(); } |