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 – activating the game


With all the game play elements set in place, it is time to get the application started by using the following steps:

  1. Create a new local function called gameActivate() and insert gameIsActive = true. Place the function above the moveChar() function:

        local gameActivate = function()
          gameIsActive = true
        end
  2. Initialize all the game actions by making a new function called gameStart():

        local gameStart = function()
  3. Start the physics property and set the gravity for the falling object:

          physics.start( true )
          physics.setGravity( 0, 9.8 )
  4. Activate all the functions instantiated. Add an event listener for the charObject, using the "accelerometer" event for the moveChar() function:

          drawBackground()
          createChar()
          eggTimer()
          hud()
          gameActivate()
          Runtime:addEventListener("accelerometer", moveChar)
        end
  5. Instantiate the gameStart() function and return the gameGroup group:

        gameStart()
        return gameGroup

What...

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)