We're going to create the frontend of our game by introducing the game title, Play button, and Options button that will transition throughout different scenes in the application with ease.
Create a new file called
mainmenu.lua
and import Storyboard and UI modules, thestoryboard.newScene()
function, and the variables for timer and audio.local storyboard = require( "storyboard" ) local scene = storyboard.newScene() local ui = require("ui") local btnAnim local btnSound = audio.loadSound( "btnSound.wav" )
Create the
createScene()
event. Add in the line,storyboard.removeScene( "maingame" )
andstoryboard.removeScene( "options" )
, which will remove the"maingame" and "options"
scene. Removing"maingame"
will occur after the player has transitioned from the main game screen and is sent to the main menu screen. Removing"options"
will occur after the player has transitioned from the options screen and is sent to the main menu screen.-- Called when the scene...