DaVikingCode/Citrus-Engine

LevelManager / A level gist

Opened this issue · 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.

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 ?

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