Unless you are explicitly calling storyboard.removeScene(“level1”) in one of your other scenes, any code sitting in level1’s main chunk will never re-execute. You must either removeScene() before going to level1 or in level1, put all of that code in “enterScene” or “willEnterScene”.
OK so i changed main.lua to point to level 2.lua. (bypassing level1) and everything works perfectly. The problem is the transition between scenes (level 1 to level2) and somehow losing the physics engine along the way. I tried putting everything (objects, functions, require physics as well the functions from my 2 modules (tiles and leveldata) into the enter scene function and lo and behold it works fine. So whats the deal with create scene not working when you move between scenes but works ok when you drop in from main.lua?
cheers for advice, at least its working now even if im not following why!
Can you post your code inside of [code] and [/code] tags? Limit it to your main chunk and the four main storyboard functions and anywhere you are starting and stopping physics.
well i’m still working on this one but i think i’ve solved it now thanks to your guidance. The willEnterscene needs to be used as the createScene doesnt seem to be recalled upon returning to the original scene. Once i’ve applied the willenterscene to this app then i’ll drop in with a further update. I tested this with a smaller app of mine and that solved the storyboard issues there as well.
The biggest problem i had with is that the storyboard template i downloaded didnt include the willenterscene. So i just followed instructions of putting display objects in createScene and everything else in enterScene. Which didnt work. Cheers for all advice so far, slowly getting the hang of it now!
More news as it happens…
all solved now - i declare and turn on physics in main.lua and use the willEnterScene to load images and enterScene to fire event listeners. I don’t really touch the physics after that at all - Is there a need to stop and start physics between scenes? Doesnt seem to cause any issues…
Just converted a program that was using director to using storyboard instead so feeling pretty happy now