Movement constrains

Hello everyone,

How can I limit the movements on grids? I tried to restrict the movement through the coordinates, but it’s too long and complex.

Thanks in advance!

Make a 2 dimensional array with the grid spaces in it. If not walk-able give it a certain value. Check that value before you want to move to a certain grid.

1 Like

Simply set the grid cell’s value to 0 if it can’t be walked on, and 1 if it can. Then check if the cell is equal to 1 before performing any pathfinding or movement.

You’re right!