Tile Based Pathfinding? (Left, right, up, down only)

Hi all,

I’m quite new to programming. I’m making a game that has a space (tile)-based battlefield. That is, the battlefield is a bunch of squares and you move x squares per turn.

You click on the square you want to move to and move to it. My question is, can this pathfinding system work in this way?

From what I can tell, it seems best suited for open-world pathfinding where movement isn’t confined to a specific way. The AI can take any path provided it gets around the obstacles.

I need a system where the movements must be: up, down, left and right. I don’t want characters being able to go diagonally to get to the destination. So if I want to move from space 0,0 to 2,2 it should do something like: go left to 1,0, up to 1,1, left to 2,1, and up to 2,2.

Just wondering if I can have this kind of control with this system or if I’d be best finding another system.

Thanks in advance.

Hi

Set “Connections” in the grid graph settings to “Four”.
You might also be interested in this question: http://arongranberg.com/vanillaforums/discussion/1120/not-following-exact-path#latest

You might want to use a ConstantPath (pro version) to show all squares the player can move to during a single turn.