function scene:enterScene( event ) local group = self.view --Timers------------------------------------------------------------------------------ function game\_Time () time = time + 1 print("Time: "..time) end game\_Time\_Timer = timer.performWithDelay( 1000, game\_Time, 0 ) --Spawn Harder----------------------------------------------------------------------------- function drop\_Faster () gravity\_Speed = gravity\_Speed + 7 physics.setGravity( 0, gravity\_Speed ) print("Gravity Speed: "..gravity\_Speed) end drop\_Faster\_Timer = timer.performWithDelay( 5000, drop\_Faster, 2 ) --Characters------------------------------------------------------------------------------ function move\_Ketchup () ketchup\_X = math.random(20, 240 ) transition.to( enemy\_Ketchup, {x = ketchup\_X, time = 850} ) end move\_Ketchup\_Timer = timer.performWithDelay( 900, move\_Ketchup, 0 ) function move\_Fry (event) if ( event.phase == "moved" ) then fry\_Physical.x = player\_Fry.x - 60 hand\_Physical\_Diagonal.x = player\_Fry.x + 25 hand\_Physical\_Flat.x = player\_Fry.x + 70 player\_Fry.x = event.x end end Runtime:addEventListener( "touch", move\_Fry ) --Drops------------------------------------------------------------------------------ function spawn\_Drop (event) enemy\_Drop = display.newImage( "Assets/game\_Screen/FKdrop.png" ) enemy\_Drop.x = enemy\_Ketchup.x + 70 enemy\_Drop.y = 70 enemy\_Drop.Name = "drop" physics.addBody(enemy\_Drop, "dynamic") group:insert(enemy\_Drop) end spawn\_Timer = timer.performWithDelay( spawn\_Speed, spawn\_Drop, 0) local function removeOffscreenItems() for i = 1, #all\_Drops do local oneDrop = all\_Drops[i] if (oneDrop and oneDrop.y) then if oneDrop.y \> screenHeight then oneDrop:removeSelf() table.remove( all\_Drops, i ) print("delete") lives = lives - 1 print("Lives: "..lives) audio.play(missed\_Sound, {loops = 0}) if ( lives == 0 ) then storyboard.gotoScene("lose\_Page", "fade") KILL\_TIMERS() end end end end end Runtime:addEventListener( "enterFrame", removeOffscreenItems ) --Collisions------------------------------------------------------------------------------ function onCollision( event) if ( event.phase == "began" ) then print( "began: " .. event.object1.Name .. " & " .. event.object2.Name ) elseif ( event.phase == "ended" ) then print( "ended: " .. event.object1.Name .. " & " .. event.object2.Name ) end if ( event.phase == "began" ) then if (event.object1.Name == "fry" and event.object2.Name == "drop") then system.vibrate() print("Lives: "..lives) CallKillPlayerEndGame(event.object2); audio.play(ding\_Sound, {loops = 0}) drops\_Caught = drops\_Caught + 1 drops\_Caught\_text.text = "Drops Caught: "..drops\_Caught elseif (event.object1.Name == "drop" and event.object2.Name == "fry") then system.vibrate() print("Lives: "..lives) CallKillPlayerEndGame(event.object1); audio.play(ding\_Sound, {loops = 0}) drops\_Caught = drops\_Caught + 1 drops\_Caught\_text.text = "Drops Caught: "..drops\_Caught --enemy\_Drop:removeSelf() elseif (event.object1.Name == "hand\_flat" and event.object2.Name == "drop") then lives = lives - 1 print( "Lives: "..lives ) CallKillPlayerEndGame(event.object2); REMOVE\_SPLAT() hand\_Splat = display.newImage( "Assets/game\_Screen/FK\_handSplat.png" ) hand\_Splat.x = event.object2.x hand\_Splat.y = event.object2.y + 40 group:insert(hand\_Splat) audio.play(splat\_Sound, {loops = 0}) if ( lives == 0 ) then storyboard.gotoScene("lose\_Page", "fade") KILL\_TIMERS() end elseif (event.object1.Name == "drop" and event.object2.Name == "hand\_flat") then lives = lives - 1 print( "Lives: "..lives ) CallKillPlayerEndGame(event.object1); REMOVE\_SPLAT() hand\_Splat = display.newImage( "Assets/game\_Screen/FK\_handSplat.png" ) hand\_Splat.x = event.object2.x hand\_Splat.y = event.object2.y + 40 group:insert(hand\_Splat) audio.play(splat\_Sound, {loops = 0}) if ( lives == 0 ) then storyboard.gotoScene("lose\_Page", "fade") KILL\_TIMERS() end elseif (event.object1.Name == "hand\_diagonal" and event.object2.Name == "drop") then hand\_Splat = display.newImage( "Assets/game\_Screen/FK\_handSplat.png" ) hand\_Splat.x = event.object2.x + 20 hand\_Splat.y = event.object2.y + 20 hand\_Splat.rotation = -45 group:insert(hand\_Splat) REMOVE\_SPLAT() lives = lives - 1 print( "Lives: "..lives) CallKillPlayerEndGame(event.object2); audio.play(splat\_Sound, {loops = 0}) if ( lives == 0 ) then storyboard.gotoScene("lose\_Page", "fade") KILL\_TIMERS() end elseif (event.object1.Name == "drop" and event.object2.Name == "hand\_diagonal") then hand\_Splat = display.newImage( "Assets/game\_Screen/FK\_handSplat.png" ) hand\_Splat.x = event.object2.x + 20 hand\_Splat.y = event.object2.y + 20 hand\_Splat.rotation = -45 group:insert(hand\_Splat) REMOVE\_SPLAT() lives = lives - 1 print( "Lives: "..lives ) CallKillPlayerEndGame(event.object1); audio.play(splat\_Sound, {loops = 0}) if ( lives == 0 ) then storyboard.gotoScene("lose\_Page", "fade") KILL\_TIMERS() end end end end Runtime:addEventListener("collision", onCollision) function CallKillPlayerEndGame(enemytoKill) --Used a timer to execute to kill the enemy - because you can not remove an object during the --Collision so we execute a small delay to allow the collision to complete. timer.performWithDelay( 1, function() enemytoKill:removeSelf() end ) end function REMOVE\_SPLAT () timer.performWithDelay( 800, function() hand\_Splat:removeSelf() end ) end --Level 2------------------------------------------------------------------------------------------ function go\_to\_Level2 () storyboard.gotoScene("bite\_Screen\_1") end go\_to\_Level2\_Timer = timer.performWithDelay( 15000, go\_to\_Level2, 1 ) --End Game------------------------------------------------------------------------------------------ function KILL\_TIMERS () timer.cancel( game\_Time\_Timer ) timer.cancel( move\_Ketchup\_Timer ) timer.cancel( spawn\_Timer ) timer.cancel( go\_to\_Level2\_Timer ) enemy\_Drop:removeSelf( ) end end
Yea I used that, and it fixed the restarting, but the drop still spawns. Heres the bulk of the code. Also, thank you so much!