On Thu, Apr 14, 2011 at 3:16 PM, claudio canepa <[email protected]> wrote:
> > > On Thu, Apr 14, 2011 at 5:55 AM, equant <[email protected]> wrote: > >> I can get a transition to work if I use push... >> >> director.push(FadeTransition(scene, duration=1)) >> >> ... but with pop there's no scene to pass. I'm not sure how to make a >> transition happen when I pop. Any ideas? >> >> Thanks >> > > What about > > class FadeTransitionWithPop(FadeTransition): > def finish(self): > director.pop() > > > [...] just for completion, I added more polished example, including the recipe in a multilene string in as a new test at cocos\test\test_transitions_with_pop_recipe.py (in r1070) It works well with any transition scene, and it reads as """ TransitionWithPop recipe While you can apply any cocos transition scene to the scene changes director.run director.replace director.push they are not builtin scene transitions to apply when doing director.pop But is easy to implement in your app with the following recipe: 1. select one of the stock scene transitions, to be found in cocos/scenes/transitions.py, say ZzzTransition 2. define a subclass class ZzzTransitionWithPop(ZzzTransition): def finish(): director.pop() 3. instead of director.pop(), use director.replace( ZzzTransitionWithPop( director.scene_stack[0], <other params>)) where <other params> are the ones needed in the original transition, excluding the 'dst' argument """ -- claudio -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
