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 – 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...