Cover by Michelle M. Fernandez

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Time for action – adding a main menu

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.

  1. Create a new file called mainmenu.lua and import Storyboard and UI modules, the storyboard.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" )
  2. Create the createScene() event. Add in the line, storyboard.removeScene( "maingame" ) and storyboard.removeScene( "options" ), which will remove the "maingame" and "options" scene. Removing "maingame" will occur ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required