I need help with what I think is a problem in my composer flow

I have a question, I have this game I am almost finished making,
but I am running into what I think is a problem with composer.
try playing my game in Tom Burger 3 HTML5 English version
you will find you can finish the level twice, but the thid time you finish the level
and click on start on dailyScoresScreen.lua it will crash with error indicating that in
line 299 of game.lua that sceneGroup is nil. since it works twice I don’t get why it wont
work a third or more times.

(you can clear a level just by avoiding the mouse and the poop if you want,
I have made the time go by quickly, so what would normally take 8 minutes just takes a short time)

this is my github GitHub - amigojapan/TomBurger3Solar2d: Hamburger Simulation game

I think the problem is either is dailyScoresScreen.lua or in game.lua.

all help appreciated!,

amigojapan

It doesn’t crash if you force a scene recycle by doing this on your main.lua:

local composer = require( "composer" )
composer.recycleOnSceneChange = true -- force scene recycle

Not directly affected, but also noted a global variable of sceneGroup in your game.lua line 9.

On that note, you should try to keep all variables local to each composer scene. You are already using composer to move data between scenes so there’s no reason to use globals. :slight_smile:

2 Likes

oh thanks! I will try that now…

oh, thanks so much! it worked! much appreciated!

1 Like

Thanks for your help :smiley:

1 Like