cls
sync rate 0
Sync On
rem backdrop on
rem color backdrop 0
` GLOBAL STUFF -----------------------------------------------------
` INIT begin with loading the gosub main
gosub main:
` GOSUBS ----------------------------------------------------------
main:
sync
Rem Text info for menu goes here!
Set text font textshape$
Set text size 28
Rem Menu Goes here! Keep adding 52 to the second number!
center text 320,100,"Arcade"
center text 320,152,"Time Trial"
center text 320,204,"Practice"
center text 320,256,"Options"
center text 320,308,"Exit"
do
rem the pattern: subtract 20, add 52, subtract 16, add 52!
rem Arcade mode!
if btn_click(220,75,440,125)
gosub arcade
endif
rem Time Trial Mode!
if btn_click(200,127,424,177)
gosub timetrial
endif
rem Practice Mode!
if btn_click(200,179,424,229)
gosub practice
endif
rem Options!
if btn_click(180,231,408,281)
gosub options
endif
rem Exit!
if btn_click(180,283,408,333)
cls
print ". end program ."
end
endif
` use sync at the bottom of any loop near the loop statement.
` effectivly refreshing the monitors display at the end of each loop
sync
loop
return
` menu gosubs ---------------------------------------------
arcade:
cls
rem more menu choices! Add 52 to second number1
set text font textshape$
set text size 28
center text 320,100,"Select Car"
center text 320,204,"Select Track"
center text 320,308,"Race!"
do
rem the pattern: subtract 20, add 52, subtract 16, add 52!
rem Select Car!
if btn_click(220,75,440,125)
gosub select_car
endif
rem Select Track!
if btn_click(200,179,424,229)
gosub select_track
endif
rem Race!
if btn_click(180,283,408,333)
gosub race
endif
sync
loop
return
timetrial:
cls
print "You have reached time trial mode! Press any key to contunue!"
suspend for key
gosub main
return
practice:
cls
print "You have reached practice mode! Press any key to continue!"
suspend for key
gosub main
return
options:
cls
rem expanded options! Add 52 to second number!
set text font textshape$
set text size 28
center text 320,100,"Controller Config"
center text 320,152,"Sound And Music"
center text 320,204,"Sound Test"
center text 320,256,"Difficulty"
center text 320,308,"Return to Main Menu"
do
rem the pattern: subtract 20, add 52, subtract 16, add 52!
rem Controller Config!
if btn_click(220,75,440,125)
gosub controller_config
endif
rem Sound and Music!
if btn_click(200,127,424,177)
gosub sound_and_music
endif
rem Sound Test!
if btn_click(200,179,424,229)
gosub sound_test
endif
rem Difficulty!
if btn_click(180,231,408,281)
gosub difficulty
endif
rem Return to main menu!
if btn_click(180,283,408,333)
gosub return_to_main_menu
endif
sync
loop
return
select_car:
cls
print "This is where you select your car! Press any key to continue!"
suspend for key
gosub arcade
return
select_track:
cls
print "This is where you select your track! Press any key to continue!"
suspend for key
gosub arcade
return
race:
cls
print "The game starts here! Press any key to continue!"
suspend for key
gosub main
return
controller_config:
cls
print "This is where you configure your controls! Press any key to continue!"
suspend for key
gosub options
return
sound_and_music:
cls
print "This is where you adjust the volume for the music and sfx! Press any key to continue!"
suspend for key
gosub options
return
sound_test:
cls
print "This is where you listen to the game's soundtrack! Press any key to continue!"
suspend for key
gosub options
return
difficulty:
cls
print "This is where you adjust the difficulty of the cpu! Press any key to continue!"
suspend for key
gosub options
return
return_to_main_menu:
cls
gosub main
return
`Button Click Function
function btn_click(x1,y1,x2,y2)
clicked=0
if mousex()>x1 and mousex()<x2
if mousey()>y1 and mousey()<y2
if mouseclick()=1
clicked=1
endif
if mouseclick()=2
clicked=2
endif
endif
endif
endfunction clicked
This is just some code I found sometime ago. Dont know who made it but anyway it is nothing fancy but you could realy make somthing out of it.