Colision question

Get help using Construct 2

Post » Sun Jul 15, 2012 4:58 pm

Is there a way to check if an object is in its entirety inside another object?
Or to check if every single pixel of one object is colliding with another object?
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Sun Jul 15, 2012 10:23 pm

It can be calculated easily with a bit of math if the objects are boxes or circles. Also with a bit of logic you can use collision polygons.
http://dl.dropbox.com/u/5426011/examples12/sprite_in_sprite.capx

Making it work with rotated objects would complicate things a bit. It's doable but I would opt for objects with no rotation.

Finally it is possible to do a per-pixel check with the canvas plugin but I imagine it would be dog slow.
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Sun Jul 15, 2012 11:11 pm

The user can actually change the angle of the object on a per 10 basis, and select from several differently shaped objects.

So the only solution would be to have up to 36 different mathematical expressions per shape, right? I think I'll try a different approach for my problem. :P

And I don't even want to it try with the canvas plugin, it won't end well.


Thanks for the reply.
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Mon Jul 16, 2012 1:08 am

[quote]So the only solution would be to have up to 36 different mathematical expressions per shape, right?[/quote]
I avoid such situations when I can.

Here is a further refinement of the "poly" method that handles rotation.
http://dl.dropbox.com/u/5426011/examples12/sprite_in_sprite2.capx
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Tue Jul 17, 2012 2:31 am

Thanks, I'll try to make the best use of it.
B
33
S
12
G
7
Posts: 227
Reputation: 7,582


Return to How do I....?

Who is online

Users browsing this forum: MarkThomas, theosciandra and 16 guests