Yes, we've all seen the anonymous user's simple text menu. It looks something like this?
` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com
rem improvements
rem play and exit highlight when the mouse is over them
cls
gosub makemenu
do
if (mousex() > 285 and mousex() < 385 and mousey() > 160 and mousey() < 220 and mouseclick()=1) then gosub game
if (mousex() > 285 and mousex() < 385 and mousey() > 230 and mousey() < 290 and mouseclick()=1) then gosub rip
loop
game:
cls
print "Game Starts Now."
rem this is where you write the game code
sleep 10000
gosub makemenu
return
rip:
end
return
makemenu:
set text to bolditalic
text 285,190, "Play"
text 285,260, "Exit"
return
That's the Gyst of the code, I edited some things like the music and the lava1.bmp and such. But I do believe I've found a better system. I've altered a bit, such as the Do Loop, which loops continuously and endlessly, so when you've already clicked the menu "Play" button, it will do the play function, as requested, but the spaces where the text was will still act as buttons. This is not allowable in a game. Now I'm just coming back to Dark Basic, and I'm finding that if you replace Do Loop with Repeat Until... Well... Here. Let me show you what I mean.
` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com
rem improvements
rem play and exit highlight when the mouse is over them
cls
gosub makemenu
g=0
repeat
if (mousex() > 285 and mousex() < 385 and mousey() > 160 and mousey() < 220 and mouseclick()=1) then gosub game
if (mousex() > 285 and mousex() < 385 and mousey() > 230 and mousey() < 290 and mouseclick()=1) then gosub rip
until g=1
game:
cls
print "Game Starts Now."
rem this is where you write the game code
sleep 10000
g=1
return
rip:
end
return
makemenu:
set text to bolditalic
text 285,190, "Play"
text 285,260, "Exit"
return
Heh. If you can't tell the difference between the two, here it is. In the original, if you click "Play", yes the text will disappear. But if you happen to click the spot where the Exit button was, or any other menu function, then you're in for a novice mistake. (If you don't know what I'm talking about... Try it. There's no teacher better than Experience.) ... Now in the second one, if you click "Play", the play function will work, but there is no little bugs such as it exiting when you click on the spot where the exit button was. LOL. It's a quite simple fix, and if anybody has a better update for it, please post. I'm always willing to learn.
- JAKE,
OUT!
======
Ok... So what?