From 813f23d655a7d0aa8e104d3b0fdcf0086ba0a48e Mon Sep 17 00:00:00 2001 From: Vectozavr <60608292+vectozavr@users.noreply.github.com> Date: Sun, 17 Oct 2021 14:25:09 +0700 Subject: [PATCH] Code refactoring. --- PlayerController.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PlayerController.cpp b/PlayerController.cpp index 0ce4521..c87793b 100644 --- a/PlayerController.cpp +++ b/PlayerController.cpp @@ -99,13 +99,13 @@ void PlayerController::update() { // slow mo _isInSlowMo = true; _player->setVelocity(_player->velocity() / ShooterConsts::SLOW_MO_COEFFICIENT); - _player->setAcceleration(_player->acceleration() / (ShooterConsts::SLOW_MO_COEFFICIENT * ShooterConsts::SLOW_MO_COEFFICIENT)); + _player->setAcceleration(Vec3D(0, -ShooterConsts::GRAVITY / (ShooterConsts::SLOW_MO_COEFFICIENT * ShooterConsts::SLOW_MO_COEFFICIENT), 0)); _unSlowMoSound.stop(); _slowMoSound.play(); } else if (_isInSlowMo && !Keyboard::isKeyPressed(sf::Keyboard::LShift)) { _isInSlowMo = false; _player->setVelocity(_player->velocity() * ShooterConsts::SLOW_MO_COEFFICIENT); - _player->setAcceleration(Vec3D(0, -ShooterConsts::GRAVITY * ShooterConsts::SLOW_MO_COEFFICIENT * ShooterConsts::SLOW_MO_COEFFICIENT, 0)); + _player->setAcceleration(Vec3D(0, -ShooterConsts::GRAVITY, 0)); _slowMoSound.stop(); _unSlowMoSound.play(); }