Diagonals only pathfinding for a click and move isometric game

I am making a mobile game where the player clicks on the screen to move to that position. This seems easy enough when making a game that isn’t isometric (or is isometric but the player moves in 8 directions). The issue is that the ONLY way I want the player to move is diagonally (up/right, up/left, down/right, down/left) so that the movement fits in/correlates with the isometric style of the game. I also want the player to always be in the middle of each tile (I am using a tileset to make the map) when they have finished moving. I have tried a lot of different things and none work, but this is probably because I’m relatively new to GDevelop.

To explain a bit better with two examples (example 1 in red and example 2 in blue):

Screenshot (191)

The * is where the player clicked

The arrow/line is the path the character would take

The dots on the line/arrow are just to show that the player would reach the centre of that tile before continuing on it’s path (so that the character is always moving along the centre of the tiles)

Note that at all times the character would be moving diagonally, never straight up, dow, left, or right.

Any assistance would be much appreciated…

What’s the theme of the game? Are there going to be non-passable objects? I recently created a project that uses pathfinding and linking to follow an isometric road. This used a strick path. The blank tiles don’t get linked to, so it follows the road. I’d love to experiment with your concept, I’m just not sure how your game is going to work. I’m not sure how the mover would move if it was a more open grid. I can test it later today.

IDK if this will help.

Yes there are going to be impassible objects in the game, and the theme of the game is a little weird but its actually going to be an idle game. This is just a feature I want to add so the player can walk around to their different shops and locations instead of just selecting them in a menu like most idle games. I do agree that the movement around the map will be a bit strange since the character cannot move directly in a straight line to certain point selected by the player, but tbh it doesn’t worry me too much since technically the character is walking in a straight line, it’s just shown from an isometric view. Really all I need it to do is to move to the centre of whatever tile is clicked by pathfinding around objects while following an isometric grid (or moving only diagonally in a regular grid).
Thanks for the linked project you provided, I’ll have a look at how you’ve done it and mabye I can figure a way to adapt it to my needs.

You’re welcome. It sounds interesting. Some click games can be a bit bland. Good luck. I’ll help if I can.

I have a newer version I’ve been meaning to upload. It’s not a huge change. I added a car and I switched from using tile is touched to pick nearest tile from the cursor x,y. I also changed the sprites a little.

Yea, the only thing is with yours is that there are set routes to follow. Is there a way to allow the player to go anywhere (not along a specified path)?

I added a new version of my project. There are 3 groups, 1 for tiles that can be moved to, one for obstacles and one group with the reachable objects and the link object. The last group is used to find a path. The obstacle group is used just to set their z-order.


try it:

I also changed the one condition from cursor is on link to pick the nearest link from cursor x,y That way, the mouse click doesn’t need to be so precise.

Just altered it a bit and added a bit of code for animations based on movement, and it works perfectly. Added a feature where the destination tile gets a sort of pulsing overlay to highlight it. Really appreciate the help because I never would have figured it out myself…

1 Like