# How do I use collision and distance simultaneously

Get help using Construct 2

### » Wed Oct 21, 2015 5:18 am

I have completed the intro tutorial ghostshooter, and I am now adding features like bombs. Currently when a bullet collides with the bomb, all ghosts explode. How do I make it so that only ghosts at certain radius from the bomb explode (0-max range of bomb)?
B
3
Posts: 2
Reputation: 179

### » Wed Oct 21, 2015 7:51 pm

Add this as a subevent of the event responsible for exploding the bomb:

for each ghost
system compare two values : distance(ghost.x,ghost.y,bomb.x,bomb.y) < max range of bomb
> ghost destroy
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Tue Oct 27, 2015 5:52 pm

How can I do this? For each ghost can be used as an event/subevent. Compare two values is an event/subevent as well. How can use "system compare two values : distance(ghost.x,ghost.y,bomb.x,bomb.y) < max range of bomb" as an action of the subevent "for each ghost" ?
B
3
Posts: 2
Reputation: 179

### » Wed Oct 28, 2015 6:39 am

Hack:

1. Create a circle sprite the size of your explosion radius and set its opacity to 50 for ease of use.
2. Set it to invisible by default (left side properties).
3. Spawn it at an image point center of the sprite "bomb" that goes off.
4. Do Is-overlapping check and destroy anything is touches that needs to be kilt.

Your game making has just been hacked!
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
78
S
22
G
8
Posts: 648
Reputation: 10,226

### » Wed Oct 28, 2015 8:51 am

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775