How do I get all objects in a radius?

Get help using Construct 2

Post » Sat Jan 28, 2012 4:02 am

I need this for an explosion. Once the explosion is spawned, I should do some operation (like change the HP) on all objects within 100 pixels of it.
B
2
G
2
Posts: 16
Reputation: 682

Post » Sat Jan 28, 2012 4:06 am

for each objectThatyouwantTopick
>-distance(pointofexplosion.x,pointofexplosion.y, objectThatyouwantTopick.x, objectThatyouwantTopick.y) < radius, do stuff
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sat Jan 28, 2012 4:50 am

You could use the distance() expression to affect how much hp is damaged too.
jus' sayin :)
B
28
S
8
G
1
Posts: 469
Reputation: 4,683


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, abdalghani, imothep85, LeFuji, Marxally, Virpoja and 24 guests