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


Right now, we need to set the offscreen position for the panda and have it transition to its starting launch location, so the user can interact with it.

  1. After adding the variables, create a new local function called startNewRound() and add an if statement to initiate the panda object into the scene:

    local startNewRound = function()
      if panda then
  2. Add a new local function called activateRound() within startNewRound(). Set the starting position of the panda display object on screen and add ground:toFront(), so that the ground appears in front of the panda character:

      local activateRound = function()
    
        waitingForNewRound = false
    
        if restartTimer then
          timer.cancel( restartTimer )
        end
    
        ground:toFront()
        panda.x = 240
        panda.y = 300
        panda.rotation = 0
        panda.isVisible = true
  3. Create another local function called pandaLoaded(). Set gameIsActive to true and set the panda object's air and hit properties to false. Add panda:toFront...

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)