Way to check entire object is on a hotspot? SOLVED

Started by Iphigenia, Fri 07/08/2009 12:22:31

Previous topic - Next topic

Iphigenia

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.

GarageGothic

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.

Iphigenia

Brilliant. I've just tried the quick clickable-state change, and that works perfectly.

Thanks a lot.

SMF spam blocked by CleanTalk