This example uses a 'dummy' single-pixel image for testing collisions under the mouse.
There is no need to move or draw the dummy image. Just tell ImagesCollide() where the cursor is in relation to the image to test against:
There is no need to move or draw the dummy image. Just tell ImagesCollide() where the cursor is in relation to the image to test against:
' Mouse over image Graphics 640,480,0,SOFTSYNC ' create a circle test image Local image=CreateImage(64,64,1,DYNAMICIMAGE|MASKEDIMAGE) Cls ; DrawOval 0,0,64,64 ; GrabImage image,0,0 ' create a single pixel dummy image dummyCursorImage=CreateImage(1,1,1,DYNAMICIMAGE|MASKEDIMAGE) Plot 0,0 ; GrabImage dummyCursorImage,0,0 Repeat Cls mx=MouseX() ; my=MouseY() ' draw the circle image DrawImage image,200,100 ' test for collision against dummy image result=ImagesCollide(image,200,100,0 , dummyCursorImage,mx,my,0) DrawText "Collision = "+Mid$("NO YES",result*4,3) , 10,10 Flip FlushMem Until KeyHit(KEY_ESCAPE) End