Two Pathfinding questions

Get help using Construct 2

Post » Sun Apr 12, 2015 12:42 am

1: I want the sprite I've attached the behavior to to only move in the four cardinal directions, no diagonals. I understand that disabling the "Diagonals" option means that the path will only allow those directions, but I want the sprite object to only move in those directions as well, veering along the path just outside it as it changes directions. As I have it moving over a tilemap, this sort of veering naturally means it's never lining up correctly. How do I make it so that the sprite object can only move up down left and right as it makes it's way along the path?

2: The sprite object finishes moving just next to the points I want it to end on. I assume this is something like when the edge of the sprite touches the edge of the sprite marking it's destination, it stops there. How to I make it so that it doesn't stop moving until the sprite is centered over it's destination point?
B
12
S
3
G
2
Posts: 13
Reputation: 1,823

Post » Sun Apr 12, 2015 6:36 pm

You need to implement your own movement events instead of using "move along path". After you find the path, you can use Sprite.Pathfinding.NodeCount to get the number of nodes and Sprite.Pathfinding.NodeXAt(Index), Sprite.Pathfinding.NodeYAt(Index) to get the x,y position of each node.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,610


Return to How do I....?

Who is online

Users browsing this forum: Ajbael, Darknessed, Yahoo [Bot] and 10 guests