After following the tutorial above, I came up with this. It is quite simplistic, but it works well for what I needed.
Following on from the tutorial I added in music made by ShadyDave from Free Sounds. I then added in a second menu section, which can be accessed through options:
Currently there is only two options; Music and Back. I plan on adding a third option, which will be called, “Controls”.
The current option Music will turn on or off the music. Basically it’s a switch. To create this I needed to add in some extra code in the create action:
The four new things added were:
- Music that will loop continuously, unless commanded not to
- A way to turn off and on the music
- A way to tell, which menu has been selected
- A string that changes the menu title name
Once done I added in the new code in the enter pressed action:
In the code above, the menu selected will be decided depending on what the menu_selected value is. Once selected it will look at the current menu_index, which is shown in game by a red colour. It will then run the output of the case selected.
The reason I am changing the buttons variable is because, it says how many buttons should be on screen and what buttons can be selected.
If you want to add in title text, then you will need to something like the screenshot above. You will have to set the color of the title before it is written, because for some reason when the very last menu option is selected the title will turn red, unless you set the color to the default color before writing it on screen.