A menu example by Clbembry14th Sep 2008 13:17
|
---|
Summary A simple menu with credits. Description A simple menu with credits. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com REM Project: Menu example REM Created: 9/14/2008 7:08:18 AM REM REM ***** Main Source File ***** sync on sync rate 60 disable escapekey set display mode 800,600,32 hide mouse `Variables position = 1 abletomovedown = 0 abletomoveup = 0 `menu button variables credits = 0 exitmessage = 0 `credit variables y = 620 credtimer# = 3.0 exitpos = 1 canpress = 1 do cls set text size 34 center text 400,10,"The J3M of Soft(title)" `####################################################################################################################### `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `##########__________________________________________Menu Movement____________________________________________########## `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `####################################################################################################################### menu: if position = 1 ink rgb(255,255,255),0 box 250,85,550,125 ink 0,0 box 251,86,549,124 if returnkey() = 1 if canpress = 1 goto newgame canpress = 0 endif endif endif if position = 2 ink rgb(255,255,255),0 box 250,85+50,550,125+50 ink 0,0 box 251,86+50,549,124+50 if returnkey() = 1 if canpress = 1 goto loadgame canpress = 0 endif endif endif if position = 3 ink rgb(255,255,255),0 box 250,85+100,550,125+100 ink 0,0 box 251,86+100,549,124+100 if returnkey() = 1 if canpress = 1 goto controls canpress = 0 endif endif endif if position = 4 ink rgb(255,255,255),0 box 250,85+150,550,125+150 ink 0,0 box 251,86+150,549,124+150 if returnkey() = 1 if canpress = 1 goto credits canpress = 0 endif endif endif if position = 5 ink rgb(255,255,255),0 box 250,85+200,550,125+200 ink 0,0 box 251,86+200,549,124+200 if returnkey() = 1 if canpress = 1 exitmessage = 1 canpress = 0 endif endif endif if position = 6 position = 1 endif if position = 0 position = 5 endif set text size 24 ink rgb(255,255,255),0 center text 400,100,"New Game" center text 400,150,"Load Game" center text 400,200,"Controls" center text 400,250,"Credits" center text 400,300,"Exit" `Menu down if exitmessage = 0 if canpress = 0 if returnkey() = 0 canpress = 1 endif endif if downkey() = 1 if abletomovedown = 1 position = position + 1 abletomovedown = 0 endif endif if downkey() = 0 abletomovedown = 1 endif `Menu Up if upkey() = 1 if abletomoveup = 1 position = position - 1 abletomoveup = 0 endif endif if upkey() = 0 abletomoveup = 1 endif endif `####################################################################################################################### `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `##########___________________________________________Exit Message____________________________________________########## `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `####################################################################################################################### if exitmessage = 1 position = 7 if returnkey() = 0 canpress = 1 endif ink rgb(255,255,255),0 box 200,250,600,350 ink 0,0 box 201,251,599,349 ink rgb(255,255,255),0 center text 400,260,"Are you sure you want to Exit?" `Exit message movement if exitpos = 1 if rightkey() = 1 exitpos = 2 endif if canpress = 1 `End Program if returnkey() = 1 end endif endif ink rgb(255,255,255),0 box 225,285,225+170,315 ink 0,0 box 226,286,224+170,314 endif if exitpos = 2 if leftkey() = 1 exitpos = 1 endif if canpress = 1 `Exit Exit message if returnkey() = 1 exitmessage = 0 canpress = 0 position = 5 endif endif ink rgb(255,255,255),0 box 225+180,285,225+170+180,315 ink 0,0 box 226+180,286,224+170+180,314 endif ink rgb(255,255,255),0 center text 310,293,"Yes" center text 310+180,293,"No" endif text 0,0,str$(position) text 0,15,str$(canpress) sync loop `####################################################################################################################### `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `##########____________________________________________Load Game______________________________________________########## `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `####################################################################################################################### loadgame: do cls ink rgb(255,255,255),0 center text 400,300,"Put your crap here." center text 400,550,"Press ESCAPE to return to the menu." if escapekey() = 1 goto menu endif text 0,0,str$(canpress) sync loop `####################################################################################################################### `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `##########____________________________________________New Game_______________________________________________########## `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `####################################################################################################################### newgame: do cls ink rgb(255,255,255),0 center text 400,300,"Put your crap here." center text 400,550,"Press ESCAPE to return to the menu." if escapekey() = 1 goto menu endif text 0,0,str$(canpress) sync loop `####################################################################################################################### `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `##########__________________________________________The Controls_____________________________________________########## `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `####################################################################################################################### controls: do cls ink rgb(255,255,255),0 center text 400,300,"Put your controls here." center text 400,550,"Press ESCAPE to return to the menu." if escapekey() = 1 goto menu endif text 0,0,str$(canpress) sync loop `####################################################################################################################### `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `##########___________________________________________The Credits_____________________________________________########## `##########___________________________________________________________________________________________________########## `##########___________________________________________________________________________________________________########## `####################################################################################################################### credits: do cls if escapekey() = 1 goto menu endif y = y-2 ink rgb(255,255,255),0 set text size 72 center text 400,y,"Credits" set text size 48 center text 400,y+125,"Creator" center text 400,y+225,"Music" center text 400,y+325,"Everything else." set text size 32 center text 400,y+175,"Clinton Bembry" center text 400,y+275,"There is none." center text 400,y+375,"There isn't anything else." if y <= -400 set text size 12 credtimer# = credtimer# - .1 text 200,398,"Returning to main menu in: "+str$(int(credtimer#)) endif if credtimer# <= 0 goto menu endif set text size 12 text 0,0,str$(y) sync loop |