Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Iphigenia on Fri 07/08/2009 12:22:31

Title: Way to check entire object is on a hotspot? SOLVED
Post by: Iphigenia on Fri 07/08/2009 12:22:31
I'm trying to create a puzzle where objects must be placed entirely within hotspots (no overlap) but can't seem to figure out how to do it.  Right now, if the bottom-left corner of an object is within a hotspot then the puzzle is solved (not what I intended).

I've tried various inelegant solutions including surrounding the hotspots with 'hidden' objects and doing a pixel-perfect collision detection check, but this only worked if I made the 'hidden' objects clickable (not acceptable).

All suggestions gratefully received.
Title: Re: Way to check entire object is on a hotspot?
Post by: GarageGothic on Fri 07/08/2009 12:41:02
You could just set the object to clickable, check for collision and then immediately set it to non-clickable again. If done all within the same game loop, the player will never experience the object as clickable.

An easier solution would probably be to determine a range of x/y coordinates within which the object will overlap the hotspot, and then run a check for coordinates instead of collision.
Title: Re: Way to check entire object is on a hotspot?
Post by: Iphigenia on Fri 07/08/2009 13:25:19
Brilliant. I've just tried the quick clickable-state change, and that works perfectly.

Thanks a lot.