Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By : Michelle M Fernandez
Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By: Michelle M Fernandez

Overview of this book

Table of Contents (19 chapters)
Corona SDK Mobile Game Development Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – adding a credits screen


The credits screen that we'll create will be based on a touch event that transitions to the previous screen from which it was introduced. To add a credits screen, perform the following steps:

  1. Create a new file called creditsScreen.lua and import Composer, the composer.newScene() function, and the backgroundImage variable:

    local composer = require( "composer" )
    local scene = composer.newScene()
    
    local backgroundImage
  2. Create the create() event. Add in the composer.removeScene("options") line, which will remove the "options" scene. This will occur after the player has transitioned from the options screen and is sent to the credits screen:

    -- Called when the scene's view does not exist:
    function scene:create( event )
      local sceneGroup = self.view
    
      -- completely remove options
      composer.removeScene( "options" )
    
      print( "\ncreditsScreen: create event" )
    end
  3. Add in the show() event and the backgroundImage display object:

    -- Called immediately after scene...