How do I Circle and object to destroy it

Get help using Construct 2

Post » 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
87
S
44
G
16
Posts: 1,002
Reputation: 17,932

Post » Sat Jan 21, 2017 12:23 am

B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » 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
87
S
44
G
16
Posts: 1,002
Reputation: 17,932

Post » 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
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Wed Mar 22, 2017 4:24 am

can you link the stackoverflow solution? or paste it in here? the link is dead.
B
97
S
32
G
15
Posts: 1,183
Reputation: 16,148

Post » Wed Mar 22, 2017 7:27 am

Sounds like it's averaging the x, and y's and grabbing the closest to that point.
Image ImageImage
B
168
S
50
G
169
Posts: 8,283
Reputation: 108,195

Post » 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
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » 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
27
S
7
G
58
Posts: 1,229
Reputation: 34,780


Return to How do I....?

Who is online

Users browsing this forum: unxcellent, Yahoo [Bot] and 10 guests