The physics and remaining game functions need to be initialized to run the game. All game actions need to be delayed until the Help screen has left the stage.
Start the game by creating a new function called
gameInit()
that will hold thephysics
properties and activate the display objects on the stage.local gameInit = function() physics.start( true ) physics.setGravity( 0, 9.8 ) drawBackground() createPowerShot() createPanda() createStars() hud()
Add in a
Runtime
event listener using"touch"
foronScreenTouch()
.Runtime:addEventListener( "touch", onScreenTouch )
Have the level and timer start 10 seconds later so the user has time to read through the help text. Close the function and start the game with
gameInit()
.local gameTimer = timer.performWithDelay( 10000, function() startNewRound(); end, 1 ) local gameTimer = timer.performWithDelay( 10000, function() startTimer(); end, 1 ) end gameInit()
All the code is complete! Run the...