You only need a 2x2 sprite at the tip of the mouse (hidden) and check for that sprite. If you check the whole mouse sprite then it'll show up as a hit even if the tail is touching the button.
Hope this helps.
sync rate 0
sync on
` Make a small box for the end of the mouse
ink rgb(255,255,255),0
box 0,0,1,1
get image 1000,0,0,1,1,1
` Make a "button" for testing
ink rgb(150,150,150),0
box 0,0,50,20
get image 1,0,0,50,20,1
cls
` Make two "buttons" from image 1
sprite 1,10,10,1
sprite 2,10,50,1
` Make the 2x2 image a sprite at the mouse location and hide the sprite
sprite 100,mousex(),mousey(),1000
hide sprite 100
do
` Always keep the small 2x2 box at the mouse location
sprite 100,mousex(),mousey(),1000
` Check for mouse button being clicked
if mouseclick()
` Check both buttons for clicking
for t=1 to 2
` Check if the 2x2 image is touching the "button" sprite
if sprite collision(100,t)
text 0,100,"Mouse clicked on sprite "+str$(t)+"!"
a=timer()
endif
next t
endif
if timer()>=a+50
cls
a=0
endif
sync
loop