stop moving along a path when a distance is met

Get help using Construct 2

Post » Sat Feb 22, 2014 1:02 pm

Hi,

I want to stop my sprite moving along a path when a specific distance from the end is reached (i.e. 300px from end point). Is this possible?

/Jamie
B
5
S
1
Posts: 34
Reputation: 364

Post » Sat Feb 22, 2014 1:32 pm

Compare two values:
distance(sprite.X,Sprite.Y,Sprite.Pathfinding.NodeXAt(Sprite.Pathfinding.NodeCount-1),Sprite.Pathfinding.NodeYAt(Sprite.Pathfinding.NodeCount-1))
<
300
=> Stop
B
34
S
9
G
3
Posts: 517
Reputation: 5,226

Post » Sat Feb 22, 2014 10:10 pm

Thanks Katala, this worked great.

/Jamie
B
5
S
1
Posts: 34
Reputation: 364


Return to How do I....?

Who is online

Users browsing this forum: plinkie, rayolf and 7 guests