i was stuck on this for 3 days and i got it to work by doing this i don't know if it is the right way but it works
load image "\media\gamemenu.jpg",1
sprite 1,0,0,1
rem this loads images for the image buttons
load image "\media\menu.JPG",2
sprite 2,75,50,2
load image "\media\new game.JPG",3
sprite 3,75,200,3
load image "\media\exit game.JPG",4
sprite 4,75,300,4
rem cursor
load image "\media\cursor.dds",5
do
sprite 5,mousex(),mousey(),5
if sprite exist(3) then gosub clearscreen
if sprite exist(4) then gosub endgame
sync
LOOP
clearscreen:
if mouseclick()=1 and sprite collision(5,3)>0
delete sprite 1
delete sprite 2
delete sprite 3
delete sprite 4
delete image 1
delete image 2
delete image 3
delete image 4
endif
return
endgame:
if mouseclick()=1 and sprite collision (5,4)>0 then end
return