Hi Claudio, > Revisiting the duplication problem, if it is acceptable to start the > action at the first on_enter call a cleaner solution is possible: > - in __init__ put a flag > self.action_started = False > - in on_enter play the action only if the flag is False and set the flag > to True > That will work even when playing multiple transitions >
The goal was to start the action *after* the transition is completed. To give a small example, imagine an arcade game. When the game starts, things are flying around and the player must move accordingly. If we make a FadingTransition from the Menu to the Game scene, the game scene will *enter* when the TransitionScene enters, before being visible as the menu is fading out. What I was looking for is a way to wait for the transition to complete and then run the game. So that during the transition, when we start to see the Game Layer appearing, everything on it is frozen. And then when the transition is completed, the actions starts. > Not sure if its worth the added complexity in Scene. In a concrete case, I > would use blinker to publish that event (no need to know the emitter to > register) and be done with that. > Sounds like the solution I'm going to use for my own project. I was just wondering if this *problem* shouldn't be solved by cocos itself. But for the moment, I'll go with blinker and see if anybody else is asking for this feature to be available in cocos. Given that the user should know director operates as stack, and that pop > and replace are visible and surely familiar, he/she can probably write > > def replace_entire_director_stack(new_scene): > while len(director.scene_stack)>1: > director.pop() > director.replace(new_scene) > > So I think the feature scores too low to be done. > Sounds very good to me like this. I will open an issue on GitHub for the memory leak and if you agree, I will push on master a fix using your suggestion. By the way, I thought it would have been better to implement a unittest for this problem. But looking at the tests for scenes test_director_scene_changes.py, I noticed that it's not dealing with transitions. Should I add one test there? But that means I'll need to add a dependency with TransitionScene. Or should I make a new unittest file for testing transitions? Daniel. -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cocos-discuss. For more options, visit https://groups.google.com/d/optout.
