Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We're going to execute the timer for the egg so they can start dropping them on the screen.
eggTimer() and use timer.performWithDelay to drop an egg every 1 second (1000 milliseconds) repeatedly. Use eggDrop() to activate the drop. local eggTimer = function()
startDrop = timer.performWithDelay( 1000, eggDrop, 0 )
end
if statement in the onEggCollision() function, cancel the timer using the timerID, startDrop. Add the statement if gameLives < 1 to stop the eggs from falling. if gameLives < 1 then
timer.cancel( startDrop )
print("timer cancelled")
end