How to use the distance variable?

Get help using Construct 2

Post » Sun Dec 01, 2013 7:19 pm

How can I used the distance variable to keep enemies from running into certain environmental assets? I can't seem to get it to work!

Thanks guys!
B
4
Posts: 78
Reputation: 606

Post » Sun Dec 01, 2013 8:25 pm

Not sure how your looking to apply it, but distance works like:

distance(a.X,a.Y,b.X,b.Y)

this gives the ditstance between a and b

Applying it could be something like

Compare variables
distance(a.X,a.Y,b.X,b.Y) < 100
action: stop moving



Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Sun Dec 01, 2013 9:43 pm

That's actually perfect, and seems to be working great now! Thanks alot!
B
4
Posts: 78
Reputation: 606


Return to How do I....?

Who is online

Users browsing this forum: kurtbal, Seruza and 7 guests