I don't remember the exact code off the top of my head, but it should give you a good idea. TOUCH OUT SX,SY,ST IF ST==1 THEN BOUNDS=GETBOUNDS(SX,SY) ENDIF IF ISWITHINBOUNDS(SX,SY) THEN 'DO SOMETHING DEPENDING ON BOUNDS ENDIF