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:
Hide the status bar and add in the
display.newGroup()
group calledgameGroup
:display.setStatusBar( display.HiddenStatusBar ) local gameGroup = display.newGroup()
Include the external modules in the game:
local physics = require "physics"
Add in the display objects:
local background local ground local charObject local friedEgg local scoreText local eggText local livesText local shade local gameOverScreen
Add in the variables:
local gameIsActive = false local startDrop -- Timer object local gameLives = 3 local gameScore = 0 local eggCount = 0 local mRand = math.random
Create the egg boundaries and density...