sync on : sync rate 60
`loading the button
BitmapButton("Normal.bmp","Click.bmp")
do
`controlling the buttons
buttonControl()
sync
loop
function BitmapButton(Normal$,Click$)
load image Normal$,1
make object plain 1,25.6,12.8
position object 1, -10,-10,0
texture object 1,1
Set Object Transparency 1,1
load image Click$,2
make object plain 2,25.6,12.8
position object 2, -10,-10,0
texture object 2,2
Set Object Transparency 2,1
endfunction
function buttonControl()
mx=mouseX()
my=mousey()
if mx=>15 and mx<450 and my>400 and my<520 and mouseclick()=0 then
exclude object off 1
exclude object on 2
if mx=>16 and mx<451 and my>399 and my<519 and mouseclick()=1
exclude object on 1
exclude object off 2
endif
endfunction
Is there a better way of doing this? I have a function that makes the button which is outside of the game loop then there a function which controls the button, which is in the game loop. Is there a way I can combine them or is this the perfered method?