Hello, I am having a problem with scene changing that may be difficult to fully describe, but I will do my best. Currently, what I am trying to do is go from a game scene to a game over scene. On the game over scene is a button that would return the player back to a refreshed game scene.
This is my first project, and I’m sure my code is an absolute nightmare. I’ve been battling with my code for a full three days now and finally have it (at best) in a state where the Game Over scene appears. When I click the button to start over, though, it just transitions to a solid black screen.
From there, I decided my problem might have been that I needed to removeScene() the level scene so it could load from scratch when returned to. However, when I try to call storyboard.removeScene(“level1”) from the enterScreen portion of the game over scene, I get an error that states: “Attempt to perform arithmetic on field ‘y’ (a nil value)” and refers to a line in my level1 scene. I’ve made all of my timers and display objects local variables, and I’ve tried to removeEventListener on all of my Runtime listeners. Still, every time I try to remove the scene it gives me an error. I’ve purchased three Corona SDK books and have scoured the internet trying to learn details about removing/purging/transitioning/returning to scenes, and all I can find is “This is what it’s for”, and “this is sort of how you do it in a simple scenario”.
My questions are:
-
Does anyone know of a good, thorough resource that explains how storyboard scene changes work, and how to fully clean up a scene?
-
Does anyone have any idea why I might be seeing the “Attempt to perform arithmetic on field ‘y’ (a nil value)” message referring to my level1 scene when I’m trying to removeScene() from an entirely different scene?
I can add my code here if necessary, but I thought I’d see if I’m missing something blatantly obvious before I spat out 1000 lines of code here.
Thanks for the help