reload a scene

question, so i have a game with 15 levels and i was able to reload my scene by creating an intermediate scene meaning,

i have level 1 and whenever i want my scene to start from the beginning or my player wants to restart the level i have created a reload level 01, in this one i completely remove level 01 first  and then re send it to level one which makes my level 01 start from the beginning, 

so the problem is i have 15 levels does that mean i have to create 15 extra reload scenes so i can do this for every single level, is it possible to create one scene so that it can handle all 15 levels?

this is what my reload scene looks  like

local storyboard = require( “storyboard” )

local scene = storyboard.newScene()

function scene:createScene( event )

    local group = self.view

storyboard.removeScene(“level01”)--------------remove level scene

end

function scene:enterScene( event )

    local group = self.view

    local changeScene = function()

        storyboard.gotoScene(“level01”)-------------resend to the level scene

    end

    myTimer=timer.performWithDelay(500,changeScene,1)

    

end

if possible

how can i make this remove any level and then resend it to that level so i dont have 15 extra pages

You should be able to use just one reload.  There are several different methods of passing data between scenes.  One of the natural ways for storyboard is to use a params table as part of the options:

local options = {        time = 500,        effect = "crossFade",        params = {                reloadScene = "level01"        } } storyboard.gotoScene("reload", options)

Then in your enterScene you could do:

function scene:enterScene( event )     local group = self.view       local returnToScene = event.params.reloadScene        local changeScene = function()         storyboard.gotoScene(returnToScene)-------------resend to the level scene     end     myTimer=timer.performWithDelay(500,changeScene,1)      end

thanks, is there a book you might recommend me, i bought dr burtons book but not much is said on storyboard, i want something that talks about stuff in debth

You should be able to use just one reload.  There are several different methods of passing data between scenes.  One of the natural ways for storyboard is to use a params table as part of the options:

local options = {        time = 500,        effect = "crossFade",        params = {                reloadScene = "level01"        } } storyboard.gotoScene("reload", options)

Then in your enterScene you could do:

function scene:enterScene( event )     local group = self.view       local returnToScene = event.params.reloadScene        local changeScene = function()         storyboard.gotoScene(returnToScene)-------------resend to the level scene     end     myTimer=timer.performWithDelay(500,changeScene,1)      end

thanks, is there a book you might recommend me, i bought dr burtons book but not much is said on storyboard, i want something that talks about stuff in debth