; ImageRectOverlap Example ; ------------------------ Graphics 640,480,0,2 SetBuffer BackBuffer() player=LoadImage("media/player.bmp") px=100 py=100 While Not KeyDown(1) Cls ; Arrow keys steer the ship If KeyDown(203) Then px=px-3 If KeyDown(205) Then px=px+3 If KeyDown(200) Then py=py-3 If KeyDown(208) Then py=py+3 ; ImageRectOverlap tests the ship's bounding box against a screen ; rectangle (a 'hot spot') - fast, but transparent pixels count too hit=ImageRectOverlap(player,px,py,250,180,140,120) ; Draw the hot zone - red while the ship overlaps it If hit Then Color 255,60,60 Else Color 80,200,80 End If Rect 250,180,140,120,False DrawImage player,px,py Text 0,0,"Arrow keys: fly the ship into the zone Esc: exit" Text 0,20,"ImageRectOverlap(player,"+px+","+py+",250,180,140,120)="+hit Flip Wend End