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
90
S
44
G
17
Posts: 1,012
Reputation: 18,527

Post » Sat Jan 21, 2017 12:23 am

B
94
S
33
G
118
Posts: 5,395
Reputation: 75,851

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
90
S
44
G
17
Posts: 1,012
Reputation: 18,527

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
94
S
33
G
118
Posts: 5,395
Reputation: 75,851

Post » Wed Mar 22, 2017 4:24 am

can you link the stackoverflow solution? or paste it in here? the link is dead.
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

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
172
S
50
G
183
Posts: 8,443
Reputation: 115,605

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
94
S
33
G
118
Posts: 5,395
Reputation: 75,851

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
28
S
7
G
58
Posts: 1,229
Reputation: 34,830


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests