On Mon, Apr 12, 2010 at 4:13 PM, Lucio Torre <[email protected]> wrote:
> 2010/4/7 Lucas Caro™ <[email protected]>: > > Hi all, is there a way to use transitions when doing director.pop? > > So far i know how to add transitions to incoming scenes, > > (director.replace(Transition(scene)) or director.pushTransition(scene)), > > right? ) > > but I've found no way to pop using transitions without touching the core. > > I can think of a hacky way to do it: > do the transition to the scene in the stack and then remove that scene > once, leaving it again at the top as if you just poped the previous > one. > > Thanks! what I've ended up doing (probably worse) was to change the code for director.pop to: def pop(self, transition=None): """Pops out a scene from the queue. This scene will replace the running one. The running scene will be deleted. If there are no more scenes in the stack the execution is terminated. """ self.dispatch_event("on_pop",transition) def on_pop(self, transition=None): self.next_scene = self.scene_stack.pop() if(transition!=None): self.next_scene = transition(self.next_scene) and that allows me to do something like def my_fade_transition(scene,duration = 0.2): return FadeTransition(scene, duration) and then use it with: director.pop(my_fade_transition) It's probably not so good to mess with transitions in the director code.. -- Lucas S. Caro [email protected] 202-657-Go33 (4633) http://www.triplesmart.com -- 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.
