Best way to reload a composer scene

Hello,

I am still new to Lua and Corona SDK and I’m trying to reload a scene using this reload.lua file but the problem I have is once the game reloads it doesn’t destroy the scene properly keeping an existing copy of the game therer which means everything is double on the screen.

Reload.lua :

local composer = require("composer") local scene = composer.newScene() ----------------------------------------- -- Reload The Game -- composer.removeScene( "scenes.game" ) composer.gotoScene( "scenes.game" ) ----------------------------------------- return scene

I’m very new to game development using Lua and Corona not had any experience at all! Thanks if someone could point me in the right direction! 

That is generally the way I do things.

Thanks for the response! Maybe I have the game.lua file set up wrong. :/ 

What you can do is to put the graphics that you want to ‘reload’ in a displayGroup.

When the user selects ‘replay’, you just remove the displayGroup (using display.remove() function), then redraw them. In this way, you don’t need to reload the scene.

I now seem to have a problem where the reload.lua can only reload the game scene once? 

Any errors in your console log? Can you post the code going back to your game scene?

That is generally the way I do things.

Thanks for the response! Maybe I have the game.lua file set up wrong. :/ 

What you can do is to put the graphics that you want to ‘reload’ in a displayGroup.

When the user selects ‘replay’, you just remove the displayGroup (using display.remove() function), then redraw them. In this way, you don’t need to reload the scene.

I now seem to have a problem where the reload.lua can only reload the game scene once? 

Any errors in your console log? Can you post the code going back to your game scene?