Move towards object, but stop near it

For questions about using Classic.

Post » Sun Oct 23, 2011 11:32 am

How to make one object move towards another, but stop when distance between them is 100px or less?
B
11
S
3
G
6
Posts: 193
Reputation: 4,234

Post » Sun Oct 23, 2011 12:12 pm

Use the system expression 'Distance between points', or distance(x1, y1, x2, y2), e.g.

+ System: distance(objectA.X, objectA.Y, objectB.X, objectB.Y) Greater than 100
-> objectA: Move 80 * TimeDelta pixels at angle(objectA.X, objectA.Y, objectB.X, objectB.Y) degrees
-> objectA: Set angle towards objectB
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: GameOverBeast and 2 guests