lua - Corona: Restart scene when game completed -
when player has completed game, scene restarted, i.e want reload current scene. have tried storyboard:reloadscene() without success. tried purge scene , reload it, without result.
local function oneveryframepoop() if(foodballs) = foodballs.numchildren, 1, -1 local ball = foodballs[i] if(ball.y > 200 , not(ball.isbeingpooped)) ball.isbeingpooped = true local function tempremove() if(foodballs.numchildren)then ball:removeself() ball = nil print("removed") end end physics.removebody(ball) transition.to(ball, {time = 2000, y = 400, oncomplete = tempremove}) audio.play(fartsound) end end if(foodballs.numchildren == 0 , food.numchildren == 2) reward.playrewardanimation() runtime:removeeventlistener("enterframe", oneveryframepoop) timer.performwithdelay(2500, reloadscenewithdelay) end end end function reloadscenewithdelay() storyboard.gotoscene("levels.leveldigestion") -- **here want restart scene** end
nothing seems happen @ all. missing here ?
i didn't use storyboard but, can try :
create black scene in storyboard then, when want restart, go black scene , afterwards scene want go.
the problem may trying call module itself.
Comments
Post a Comment