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