Skip to content

Commit

Permalink
Fixed 2D walking restriction and therefore non-working map changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrdacor committed Aug 19, 2020
1 parent ddff4ab commit b79ba3f
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions Ambermoon.Core/Render/Player2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];
Expand Down

0 comments on commit b79ba3f

Please sign in to comment.