heres my version:
NewGame:
repeat
until mouseclick()=0
sync on : randomize timer()
ink rgb(255,255,255),0
set text size 14
center text 320,240,"LOADING..."
sync
gosub init_stuff
paste image NumGrid,90,90
`-------------------------------------------------
`MAIN LOOP
`-------------------------------------------------
do
sync
if mouseclick()=1
gosub CheckGridClick
select LessGreater
case 1
ink 0,0
for fillrow=1 to row
if fillrow<row
for fillcolumn=1 to 10
box (fillcolumn-1)*30+90,(fillrow-1)*30+90,fillcolumn*30+90,fillrow*30+90
next fillcolumn
else
for fillcolumn=1 to column
box (fillcolumn-1)*30+90,(fillrow-1)*30+90,fillcolumn*30+90,fillrow*30+90
next fillcolumn
endif
next fillrow
endcase
case 2
cls
gosub Win_Sequence
endcase
case 3
ink 0,0
for fillrow=10 to row step -1
if fillrow>row
for fillcolumn=1 to 10
box (fillcolumn-1)*30+90,(fillrow-1)*30+90,fillcolumn*30+90,fillrow*30+90
next fillcolumn
else
for fillcolumn=10 to column step -1
box (fillcolumn-1)*30+90,(fillrow-1)*30+90,fillcolumn*30+90,fillrow*30+90
next fillcolumn
endif
next fillrow
endcase
endselect
endif
loop
`-------------------------------------------------
`SUBROUTINES
`-------------------------------------------------
init_stuff:
`since sync is on then this cls wont show
cls
`this will ensure new game works
if image exist(100)=1 then delete image 100
`make image of grid of numbers
num=1
set text size 10
for y=0 to 9
for x=0 to 9
red=rnd(155)+100
green=rnd(155)+100
blue=rnd(155)+100
ink rgb(red,green,blue),0
box x*30,y*30,(x+1)*30,(y+1)*30
ink 0,0
center text x*30+15,y*30+6,str$(num)
inc num
next x
next y
NumGrid=100
get image NumGrid,0,0,300,300
cls
`make a random target number
target=rnd(99)+1
return
CheckGridClick:
if mouseover(90,90,390,390)=1
mx=mousex() : my=mousey()
for row=1 to 10
if (row-1)*30+90<=my and my<=row*30+90
for column=1 to 10
if (column-1)*30+90<=mx and mx<=column*30+90
ink 0,0
LessGreater=CheckLessGreater(column,row,target)
goto skip
endif
next column
endif
next row
skip:
endif
return
Win_Sequence:
cls
red=rnd(155)+100
green=rnd(155)+100
blue=rnd(155)+100
ink rgb(red,green,blue),0
box 305,225,335,255
ink 0,0
center text 320,231,str$(target)
dim buttoncoords(2,4)
left=1 : top=2 : right=3 : bottom=4
buttoncoords(1,left)=320-(.5*text width("Play Again"))
buttoncoords(1,top)=300
buttoncoords(1,right)=320+(.5*text width("Play Again"))
buttoncoords(1,bottom=300+text height("Play Again"))
buttoncoords(2,left)=320-(.5*text width("Quit"))
buttoncoords(2,top)=350
buttoncoords(2,right)=320+(.5*text width("Quit"))
buttoncoords(2,bottom=350+text height("Quit"))
red=rnd(155)+100
green=rnd(155)+100
blue=rnd(155)+100
ink rgb(red,green,blue),0
box buttoncoords(1,1),buttoncoords(1,2),buttoncoords(1,3),buttoncoords(1,4)
ink 0,0
center text 320,300,"Play Again"
red=rnd(155)+100
green=rnd(155)+100
blue=rnd(155)+100
ink rgb(red,green,blue),0
box buttoncoords(2,1),buttoncoords(2,2),buttoncoords(2,3),buttoncoords(2,4)
ink 0,0
center text 320,350,"Quit"
NoButtonPressed:
repeat
sync
until mouseclick()=0
repeat
sync
until mouseclick()=1
buttonpressed=0
if mouseover(buttoncoords(1,1),buttoncoords(1,2),buttoncoords(1,3),buttoncoords(1,4))=1
buttonpressed=1
endif
if mouseover(buttoncoords(2,1),buttoncoords(2,2),buttoncoords(2,3),buttoncoords(2,4))=1
buttonpressed=2
endif
select buttonpressed
case 0 : goto NoButtonPressed : endcase
case 1 : goto NewGame : endcase
case 2 : end : endcase
endselect
return
`------------------------------------------------
`FUNCTIONS
`------------------------------------------------
function mouseover(x1,y1,x2,y2)
mx=mousex() : my=mousey()
if x1<mx and mx<x2
if y<my and my<y2
exitfunction 1
endif
endif
endfunction 0
function CheckLessGreater(column,row,target)
selectedbox=(10*(row-1))+column
if selectedbox=target
exitfunction 2
endif
if selectedbox<target
exitfunction 1
endif
if selectedbox>target
exitfunction 3
endif
endfunction 0
its not as good as yours, i didnt incorporate the try system or instructions, but mine is much more organized in my opinion
also im having a weird glitch with the play again option, sometimes it works, sometimes it doesnt, if you could figure out why it would help, but its no big deal
if you have any questions just ask
There are only 10 kinds of people in the world, those who understand binary and those who dont