Checking The Map Bounds

When you go up/down and to the side at the same time, unless your in a corner, can you make it so that you only run in the direction that doesn’t run into the Bounds because you just get stuck when you do this?

The code as we have shown walks-back the whole movement if either direction is blocked. You can modify the code so it only walks-back the direction that is being blocked, the hint I’ll give is that you’ll want to split the if-statement used to test and the undoMovement function so it handles the x-axis and y-axis separately.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms