From b79ba3fb2062807cb1f457ebab01d9532d294eb9 Mon Sep 17 00:00:00 2001 From: Pyrdacor Date: Wed, 19 Aug 2020 10:46:06 +0200 Subject: [PATCH] Fixed 2D walking restriction and therefore non-working map changes --- Ambermoon.Core/Render/Player2D.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Ambermoon.Core/Render/Player2D.cs b/Ambermoon.Core/Render/Player2D.cs index ded037dc..65398374 100644 --- a/Ambermoon.Core/Render/Player2D.cs +++ b/Ambermoon.Core/Render/Player2D.cs @@ -32,7 +32,7 @@ public bool Move(int x, int y, uint ticks, CharacterDirection? prevDirection = n if (!map.IsWorldMap) { // Each map should have a border of 1 (walls) - if (newX < 1 || newY < 1 || newX >= map.Width - 1 || newY >= map.Height - 1) + if (newX < 0 || newY < -1 || newX >= map.Width || newY >= map.Height - 1) canMove = false; } else @@ -41,14 +41,6 @@ public bool Move(int x, int y, uint ticks, CharacterDirection? prevDirection = n newX += map.Width; while (newY < 0) newY += map.Height; - - if (!Map.Map.IsWorldMap) - { - while (newX >= map.Width) - newX -= map.Width; - while (newY >= map.Height) - newY -= map.Height; - } } var tile = Map[(uint)newX, (uint)newY + 1];