| Creating a simple menu | |
|---|---|
|
Commands needed: |
WAIT, CLS, PRINT, IF BUTTON()==, GOTO |
|
Time to make this: |
2-3 minuts every option |
|
Difficult: |
Easy |
|
Lines of code: |
3 options without sound: 34; 3 options with sound: 40 |
The menus are a important part in the game programming. I want to tell you a (very) simple form to make this menus.
[]
The first lines of the code of this menus
@MM1 WAIT 5 CLS
If you don't put this command wait, the cursor will be pass to the next option.
PRINT ">>>START GAME" PRINT " OPTIONS" PRINT " EXIT"
This are a basic options in a menu (in this case, a main menu). If you want to make more options, you must have to add a new lines and change the button controls.
IF BUTTON()==16 THEN GOTO @GAME IF BUTTON()==32 THEN GOTO @TITLE1 IF BUTTON()==2 THEN GOTO @MM2
Remember the buttons after the text. And remember, to:
- Button A: 16
- Button B: 32
- Control pad up: 1
- Control pad down: 2
This are the basic buttons for the menu (you can use other, if you want)
WAIT 1 GOTO @MM1
Lets make another wait point and go back.
And now lets repeat this proces but on the second option.
@MM2 WAIT 5 CLS PRINT " START GAME" PRINT ">>>OPTIONS" PRINT " EXIT" IF BUTTON()==1 THEN GOTO @MM1 IF BUTTON()==16 THEN GOTO @OPT1 IF BUTTON()==32 THEN GOTO @TITLE1 IF BUTTON()==2 THEN GOTO @MM3 WAIT 1 GOTO @MM2
Now it's time to change the text and add another line of buttons.
And for the third option:
@MM3 WAIT 5 CLS PRINT " START GAME" PRINT " OPTIONS" PRINT ">>>EXIT" IF BUTTON()==1 THEN GOTO @MM2 IF BUTTON()==16 THEN END IF BUTTON()==32 THEN GOTO @TITLE1 WAIT 1 GOTO @MM3
Extra: add sound before the options[]
If you want to add sound before this options; follow this steps:
@MM11 BEEP
The command "BEEP" is a simple sound, you can put another sound or a BGM if you want too!
Remember, if you add sound:
- Change all the lines of code; por example:
- Without sound:
IF BUTTON()==2 THEN GOTO @MM2
- With sound:
IF BUTTON()==2 THEN GOTO @MM22
I hope that this tutorial will be help someone!! If you have some questions you can use the comments.