# How do I Circle and object to destroy it

Get help using Construct 2

### » Fri Jan 20, 2017 10:43 pm

I have a sprite that leaves a trail behind it, and once its fully encircled it, i want to destroy the objects inside of it.

I've thought about trying to have the sprite collide with a copy of itself (its tail) to signify when the circle is complete, and that works sometimes, but not always. but i'm still stuck on how to determine what's inside of the circle in order to destroy them.

any suggestions?
B
91
S
44
G
17
Posts: 1,012
Reputation: 18,572

### » Sat Jan 21, 2017 12:23 am

B
97
S
36
G
131
Posts: 5,519
Reputation: 83,476

### » Sat Jan 21, 2017 9:59 pm

@R0j0hound - Thanks again R0j0 ! you're so smart!

I dont understand the math of what's going on (especially why the x/y is flipped for the prevX and prevY etc , but it works great !

thanks again!
B
91
S
44
G
17
Posts: 1,012
Reputation: 18,572

### » Sun Jan 22, 2017 7:41 pm

If it's any consolation I don't understand how it works either. It was pulled from a stackoverflow solution where someone else came up with it. I probably should dissect it sometime to understand how it works. Anyways I'm glad it helps.
B
97
S
36
G
131
Posts: 5,519
Reputation: 83,476

### » Wed Mar 22, 2017 4:24 am

can you link the stackoverflow solution? or paste it in here? the link is dead.
B
103
S
35
G
16
Posts: 1,224
Reputation: 17,192

### » Wed Mar 22, 2017 7:27 am

Sounds like it's averaging the x, and y's and grabbing the closest to that point.
B
175
S
50
G
200
Posts: 8,628
Reputation: 124,532

### » Wed Mar 22, 2017 6:08 pm

The capx's title "point in poly" are the keywords to find the stackoverflow page. But anyway I fixed the link.
B
97
S
36
G
131
Posts: 5,519
Reputation: 83,476

### » Wed Mar 22, 2017 10:08 pm

You can use a sprite circle and destroy anything it overlaps.

Similar question was asked about trapping a lion and I designed this capx:

https://www.dropbox.com/s/yt9zhr4286swp ... .capx?dl=0

Might work for you and might not?
Banned User
B
29
S
7
G
58
Posts: 1,229
Reputation: 34,910

Return to How do I....?

### Who is online

Users browsing this forum: atmas and 4 guests