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:
Create a new file called
creditsScreen.lua
and import Composer, thecomposer.newScene()
function, and thebackgroundImage
variable:local composer = require( "composer" ) local scene = composer.newScene() local backgroundImage
Create the
create()
event. Add in thecomposer.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
Add in the
show()
event and thebackgroundImage
display object:-- Called immediately after scene...