How to reload a scene and proceed like normal?

i do something similar for a “redo” button, in rough pseudocode…

– PlayScene.lua

local function onRedoPress(e)

  storyboard.gotoScene(“RedoScene”)

  – you don’t want to just call storyboard.gotoScene(“PlayScene”) here

  – as your exit/enter’s can get mixed up if you try coming and going to/from same scene at once

end

– RedoScene.lua

– essentially a do-nothing scene

– as soon as we get here we head right back to PlayScene

– but in the mean time PlayScene has had a chance to fully exit

function scene:onEnterScene()

  – you can safely purge/remove here (if you need to) prior to reentering PlayScene…

  – for my use (redo) i just wanted to launch it up again fresh from the start…

  storyboard.gotoScene(“PlayScene”)

end

Hello Rob Miracle I’m new and I dont quite get it, what is the main chunk? Is it the main.lua file? 

In Lua chunks are logical blocks of code:

function doSometing()    -- a chunk end   while someCondition do    -- a chunk    if someOtherCondition then        -- another chunk    end end

So in any given module, the “main chunk” is the module itself:

-- some lua module -- main chunk   local color = "blue"   function doSometing()    -- a chunk end   while someCondition do    -- a chunk    if someOtherCondition then        -- another chunk    end end   print ( doSomething() )

This outside block of code (that’s not inside some other block, where the color = “blue” line and the print() line are are the main chunk for that module.

Since this very well could be a main.lua file, the outer area where code can execute is the main chunk.

Rob

Hello Rob Miracle I’m new and I dont quite get it, what is the main chunk? Is it the main.lua file? 

In Lua chunks are logical blocks of code:

function doSometing()    -- a chunk end   while someCondition do    -- a chunk    if someOtherCondition then        -- another chunk    end end

So in any given module, the “main chunk” is the module itself:

-- some lua module -- main chunk   local color = "blue"   function doSometing()    -- a chunk end   while someCondition do    -- a chunk    if someOtherCondition then        -- another chunk    end end   print ( doSomething() )

This outside block of code (that’s not inside some other block, where the color = “blue” line and the print() line are are the main chunk for that module.

Since this very well could be a main.lua file, the outer area where code can execute is the main chunk.

Rob

[lua]

help me to how to remove a scene completely and redeclare it i am messed with it

my main problem is when my game starts it has a menu scene then jumps to game.lua and if it collides with a physics body it looses and go to restart scene from where it again goes to menu and then if i go on my game.lua then enemy fighter plane speed gets doubled and there bullet also speed up it is like event listeners add up twice so help i am stuck with it 

please help !

[/lua]

[lua]

help me to how to remove a scene completely and redeclare it i am messed with it

my main problem is when my game starts it has a menu scene then jumps to game.lua and if it collides with a physics body it looses and go to restart scene from where it again goes to menu and then if i go on my game.lua then enemy fighter plane speed gets doubled and there bullet also speed up it is like event listeners add up twice so help i am stuck with it 

please help !

[/lua]