Checking if sprite is inside other sprite

Get help using Construct 2

Post » Thu Dec 12, 2013 12:14 pm

How can I check if sprite is entirely inside other sprite?
B
3
Posts: 4
Reputation: 183

Post » Thu Dec 12, 2013 12:25 pm

You can first test if one is overlapping and then as a sub-event, you can test if the smaller's bounding box against the bigger one's:

-Sprite1 is overlapping Sprite2
     - Sprite1.BBoxTop > Sprite2.BBoxTop
       Sprite1.BBoxBottom < Sprite2.BBoxBottom
       Sprite1.BBoxLeft > Sprite2.BBoxLeft
       Sprite1.BBoxRight < Sprite2.BBoxRightOlivierC2013-12-12 12:25:42
B
12
S
5
G
2
Posts: 132
Reputation: 2,627

Post » Thu Dec 12, 2013 2:49 pm

Thank you very much. I didn't think of that.
B
3
Posts: 4
Reputation: 183


Return to How do I....?

Who is online

Users browsing this forum: ultrafop and 23 guests