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 – setting up the variables


Let's get started with introducing the variables we'll be using to create our game. There will be a combination of display objects and integers to keep count; we also need to preload the main sound effects used during game play. Follow the steps to declare all the required variables:

  1. Hide the status bar and add in the display.newGroup() group called gameGroup:

        display.setStatusBar( display.HiddenStatusBar )
        local gameGroup = display.newGroup()
  2. Include the external modules in the game:

        local physics = require "physics"
  3. Add in the display objects:

        local background
        local ground
        local charObject
        local friedEgg
        local scoreText
        local eggText
        local livesText
        local shade
        local gameOverScreen
  4. Add in the variables:

        local gameIsActive = false
        local startDrop -- Timer object
        local gameLives = 3
        local gameScore = 0
        local eggCount = 0
        local mRand = math.random
  5. Create the egg boundaries and density...

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)