Citrus-Engine icon indicating copy to clipboard operation
Citrus-Engine copied to clipboard

LevelManager / A level gist

Open gsynuh opened this issue 11 years ago • 2 comments

https://github.com/DaVikingCode/Citrus-Engine-Examples/blob/master/src/box2dstarling/ALevel.as ALevels should removeAll() listeners to their signals on destroy I think, its not made clear in the examples.

This gist https://gist.github.com/alamboley/4024256 Shows how to use the LevelManager and use those signals, yet I can see a potential ref to null error due to signals being dispatched when the actuall level has been destroyed because the listeners are still attached.

gsynuh avatar Nov 01 '14 17:11 gsynuh

Right, there is an issue since Signals aren't removed. However I'm not sure that the removeAll method should be called in the State's destroy method:

  • this would not be an issue for the lvlEnded, since we'll move on an other level.
  • but for the restartLevel, the results would be that we can't loose two time.

So I think those Signals should be removed before new level / Signal assignement https://gist.github.com/alamboley/4024256#file-gistfile1-as-L13 What do you think ?

alamboley avatar Nov 02 '14 12:11 alamboley

just a little update to this issue, apparently restartLevel in the box2D-starling example doesn't work

gsynuh avatar Nov 07 '14 17:11 gsynuh