From 00190facab30c04619e0c2346167f0f3480b48c8 Mon Sep 17 00:00:00 2001 From: ineslelin Date: Sun, 28 Jan 2024 17:52:18 +0100 Subject: [PATCH] minimal changes in transformcomponent::update --- src/TransformComponent.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/TransformComponent.cpp b/src/TransformComponent.cpp index 1cfc8e4..8e02ad3 100644 --- a/src/TransformComponent.cpp +++ b/src/TransformComponent.cpp @@ -54,8 +54,7 @@ void TransformComponent::update() { newPos.x = 0; } - - if (newPos.x + (this->width * this->scale) > SCREEN_SIZE_WIDTH) + else if (newPos.x + (this->width * this->scale) > SCREEN_SIZE_WIDTH) { newPos.x = SCREEN_SIZE_WIDTH - (this->width * this->scale); } @@ -64,8 +63,7 @@ void TransformComponent::update() { newPos.y = 0; } - - if (newPos.y + (this->height * this->scale) > SCREEN_SIZE_HEIGHT) + else if (newPos.y + (this->height * this->scale) > SCREEN_SIZE_HEIGHT) { newPos.y = SCREEN_SIZE_HEIGHT - (this->height * this->scale); }