function onGroundCollision( self, event ) if ( event.phase == "began" ) then if(self.myName == "egg") then if(event.other.myName == "ground") then audio.play(sound3) self.isVisible = false self:removeSelf() end end end end
local function onFrame(event) frameCounter = frameCounter + 1 if(frameCounter % 40 == 0 and eggCount > 0) then eggCount = eggCount - 1 local egg = display.newImage("egg.png") egg.x = math.random(0, 310) egg.y = 0 egg.rotation = math.random(0, 360) physics.addBody(egg, {density = 2.0, friction = 1.5, bounce=0.01})
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)