Reader small image

You're reading from  Corona SDK Mobile Game Development: Beginner's Guide

Product typeBook
Published inMar 2015
Publisher
ISBN-139781783559343
Edition1st Edition
Tools
Right arrow
Author (1)
Michelle M Fernandez
Michelle M Fernandez
Right arrow

Time for action – adding a main menu


We will create the frontend of our game by introducing the game title and the Play and Options buttons that will transition throughout different scenes in the application with ease.

  1. Create a new file called mainmenu.lua and import Composer and the UI modules, the composer.newScene() function, and the variables for timer and audio:

    local composer = require( "composer" )
    local scene = Composer.newScene()
    
    local ui = require("ui")
    
    local btnAnim
    
    local btnSound = audio.loadSound( "btnSound.wav" )
  2. Create the create() event. Add in the composer.removeScene( "maingame" ) and composer.removeScene( "options" ) lines, which will remove the "maingame" and "options" scenes. You can remove "maingame" after the player has transitioned from the main game screen and is sent to the main menu screen. You can remove "options" after the player has transitioned from the options screen and is sent to the main menu screen:

    -- Called when the scene's view does not exist:
    function...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Corona SDK Mobile Game Development: Beginner's Guide
Published in: Mar 2015Publisher: ISBN-13: 9781783559343

Author (1)