From 00c3943eaecbf20c695f55ff111619641e3e186e Mon Sep 17 00:00:00 2001 From: Vectozavr <60608292+vectozavr@users.noreply.github.com> Date: Sun, 17 Oct 2021 23:42:02 +0700 Subject: [PATCH] Code refactoring. --- PlayerController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PlayerController.cpp b/PlayerController.cpp index 0412452..02bbcc5 100644 --- a/PlayerController.cpp +++ b/PlayerController.cpp @@ -42,7 +42,7 @@ void PlayerController::update() { Keyboard::isKeyPressed(sf::Keyboard::S)); std::shared_ptr camera = _player->attached(ObjectNameTag("camera")); - if(camera != nullptr && _inRunning) { + if(camera != nullptr && _inRunning && _player->inCollision()) { if (!Timeline::isInAnimList(AnimationListTag("camera_hor_oscil"))) { Timeline::animate(AnimationListTag("camera_hor_oscil"), new ATranslate(camera, -camera->left() / 6, 0.3,Animation::LoopOut::None, Animation::InterpolationType::cos)); Timeline::animate(AnimationListTag("camera_hor_oscil"), new AWait(0));