Best way to move to make a top-down tile based game and support only up/down/right/left movement?

I’ve been working a bit with Tiled to design the levels on a top-down game. The problem I’m facing mostly is how to make a character avoid collision and to not move diagonally. I provided a screen capture for clarity.

1898260--122313--example.png

Loop throught the path it gives to you, and if it find a collision start to search an alternate way… If it works in those blocks, you might use them only for pathfind not the entire unit system… In my knowledge Unity doesn’t have 2D pathfinding yet… You have to implement yours…

I actually attempted something similar before I got to your post. Character moves on X axis until it hits a wall or at destination then moves on Y axis until at destination or hits a wall in which it just repeats. Although, this could be problematic for crevices, if you were to path into a C shaped object for example.

What do you mean by only using specific blocks instead of the entire system?

I mean using blocks that you use the Square shaped steps on the pic, not the float values ofthe transform…
I mean not “Transform.position” but “Map[i , j]”
Also you need pathfinding… Try a recursive method…

There’s a grid move script here. You can do collision by using an array lookup for tiles that are defined as passable or not passable. (Example)

–Eric

It’s really hard finding tutorials and examples for 2D layouts. I’m not really deep into my project yet. Would it be worth just learning to make a top-down game with the 3D editor?