level selection

So when i select a level from the selection scene it leads to the first level and everything works, but when i go back to the selection scene from the level 1 scene and then click level 1 again the time doesn’t reset, it continues from where it left off. the game starts with 20 seconds, but when you leave and come back it’ll start from what point you left, so if time, ran out to 0, it’ll go to -20 the second time you enter the scene. the same thing happens to the object. the first time you play level 1 the objects are removed, but if you go back to selection and then back to level 1, you no longer can click on the objects. I have a reload game button which leads to a reload file and it’ll reload the game perfectly, but not when you go back to the selection scene. i think it might have something to do with the not removing the previous scene, but when i added the remove function, everything just came back as a black empty page. and ideas? 

update, the time doesn’t go -20 any more it just stays at the time you left the scene

Hi @duracakn10,

Are you using the Composer library? If so, I suggest you read the entire guide before you proceed further, especially the “Life Cycle” topic which discusses how scenes stay in memory and so forth.

http://docs.coronalabs.com/guide/system/composer/index.html

Best regards,

Brent

I used storyboard, should i switch over?

Yes, unless your project is very intensive or nearly complete, I urge you to use Composer instead of Storyboard. At some point, Storyboard will be deprecated, so it’s best if you switch over sooner than later… and Composer is not too different from Storyboard (I find Composer to be more sensible, personally).

Brent

alright i switched over, but its giving me even more errors now haha. I made a very basic balloon popper just to start out in corona. I didn’t change any of my code, but the timer now doesn’t disappear when it enters the scene which I had to delete my place holder timer. Originally one was in place till the game started then it was replaced by the actual timer. Now when i go back to levels select screen the timer isn’t reloaded and remains at 0. The balloons from the first time i played are still there as well. I think that’s from Incorrect scene removal from my part. The balloons are no longer poppable and double are being created, which i believe is due to placement since i had to add the did and will phase. Also my reload button works, but now instead of the balloons going up all the way to the top they stop in the middle as if the wall had been moved. This is my first game so placement is still a thing i need to work on as well as how to remove the balloon objects properly

update i fixed nearly all of my issues using composer.removeHidden() the only one left is that my balloons are not being removed on click my function isnt being called for some reason

Bare with me lol, everything is working now, but when i click to reload the scene, the scene reloads once fine, then if i click to reload it again, it reload but doesn’t remove the timer from the previous one and it still continues and we end up with two timers, when the first timer is up the balloons become unpoppable because the timer is up, even thought the timer for the current game is still running. 

Hi @duracakn10,

You still need to handle timers, transitions, and some other things yourself (this was true of Storyboard too). Primarily, Composer handles the visual elements of a scene, but you’ll need to manage some variables manually.

Take care,

Brent

WHat i did was create an extra file which called composer.removeHidden(true) and composer.gotoscene(composer.getSceneName(“pevious”) in the did phase of show to fix  the reload issue, but is there a way to do reload without having to refer to an external file? i couldnt find anything about it anywhere.

Hi @duracakn10,

I’m not sure what you mean by using an extra file to call the remove. You should be able to just reload the scene from within itself. Is there some reason why that doesn’t work for you?

Brent

I use another lua file i created which i call and go to that file to refresh the page there then return to the level. i tried to due it in the page itself, but found nothing on it online and everything i tried caused errors.

Hi @duracakn10,

So, you are opening an overlay scene or something? And from that overlay, you want to refresh the underlying (main) scene?

Yes, if possible. I call a pause.lua file from a button in the level01 folder which activates an overlay and one of the buttons is to refresh the scene below, but the only way I’ve found that works in doing so is calling a reset.lua file in the restart button. I was wondering if there is a way to do so without calling the reset.lua file and just restarting the level without error, all the ways I’ve tried multiplie the balloon objects or cause the timer to have errors

Hi @duracakn10,

I suggest that you study the Composer guide, specifically the point on using overlay scenes. From an overlay scene, you can access the parent scene (the underlying scene) and perform various actions on it.

http://docs.coronalabs.com/guide/system/composer/index.html#overlays

update, the time doesn’t go -20 any more it just stays at the time you left the scene

Hi @duracakn10,

Are you using the Composer library? If so, I suggest you read the entire guide before you proceed further, especially the “Life Cycle” topic which discusses how scenes stay in memory and so forth.

http://docs.coronalabs.com/guide/system/composer/index.html

Best regards,

Brent

I used storyboard, should i switch over?

Yes, unless your project is very intensive or nearly complete, I urge you to use Composer instead of Storyboard. At some point, Storyboard will be deprecated, so it’s best if you switch over sooner than later… and Composer is not too different from Storyboard (I find Composer to be more sensible, personally).

Brent

alright i switched over, but its giving me even more errors now haha. I made a very basic balloon popper just to start out in corona. I didn’t change any of my code, but the timer now doesn’t disappear when it enters the scene which I had to delete my place holder timer. Originally one was in place till the game started then it was replaced by the actual timer. Now when i go back to levels select screen the timer isn’t reloaded and remains at 0. The balloons from the first time i played are still there as well. I think that’s from Incorrect scene removal from my part. The balloons are no longer poppable and double are being created, which i believe is due to placement since i had to add the did and will phase. Also my reload button works, but now instead of the balloons going up all the way to the top they stop in the middle as if the wall had been moved. This is my first game so placement is still a thing i need to work on as well as how to remove the balloon objects properly