Click the button
= "CLICK ME"
x1 = text width (button$) - text width (button$)
x2 = text width (button$)+ 2
y1 = text height (button$) - text height (button$)
y2 = text height (button$)+ 1
ink rgb(250,250,250),0
box x1,y1,x2,y2
ink rgb(250,0,0),0
text 1,1,button$
get image 1, x1,y1,x2+1,y2+1
cls
sprite 1,1,1,1
sync on
do
mx# = mousex() : my# = mousey()
sx# = sprite x(1) : sy# = sprite y(1)
ssx# = sprite width(1) : ssy# = sprite height (1)
if mx# => sx#-ssx# and mx# =< sx#+ssx# and my# => sy#-ssy# and my# =< sy#+ssy#
hehe = 2
Randomize rnd(400)
sx# = rnd(640) : sy# = rnd(480)
sx# = rnd(640) : sy# = rnd(480)
if sx# => 640 - sprite width(1) then sx# = 640 - sprite width(1)
if sy# => 480 - sprite height(1) then sy# = 480 - sprite height(1)
sprite 1,sx#, sy#, 1
endif
center text screen width() / 2.0, 0, "AI EXAMPLE NO 001"
center text screen width() / 2.0, 14, "VEEEEERY SMART BUTTON"
sync
loop