I guess this is really a crap method anyway. I suppose the Right Way
to make a cutscene like sequence among many objects is to simply
absolute time everything with Delays. I remembered that you can
specify the target of an action but you can't create sequences with
actions that you have assigned a target for.

On Dec 16, 8:24 pm, ldlework <[email protected]> wrote:
> I am trying to create a splash screen type Scene. In theory there
> should be two labels that, from the bottom, rise up, then fall back
> down, one after the other. I have tired to use the actions in a way I
> think would be good for doing complex sequences in order but nothing
> happens. Its hard to explain what's going on here, but the code should
> be easy enough to understand. Why do I get a blank screen?
>
> import cocos
> from cocos.director import director
> from cocos.actions import *
>
> class ByLineLayer(cocos.layer.Layer):
>     def __init__(self):
>         super(ByLineLayer, self).__init__()
>
>         writtenby = self.writtenby_label()
>         ldlework = self.ldlework_label()
>         self.action = writtenby.action + ldlework.action
>         self.add(writtenby)
>         self.add(ldlework)
>
>     def writtenby_label(self):
>         label = cocos.text.Label('Written By',
>                                  font_name = 'Times New Roman',
>                                  font_size = 30,
>                                  anchor_x = 'center', anchor_y =
> 'center')
>         label.position = 320, -50
>
>         # Action Behavior
>         moveup = AccelDeccel(MoveTo((320, 300), 2))
>         movedown = Accelerate(MoveTo((320, -50), 1.5))
>         label.action = Delay(0.1) + CallFunc(label.do, moveup +
> movedown)
>         return label
>
>     def ldlework_label(self):
>         label = cocos.text.Label('ldlework',
>                                  font_name = 'Times New Roman',
>                                  font_size = 32,
>                                  anchor_x = 'center', anchor_y =
> 'center')
>         label.position = 320, -50
>
>         # Action Behavior
>         moveup = AccelDeccel(MoveTo((320, 300), 2))
>         movedown = Accelerate(MoveTo((320, -50), 1.5))
>         label.action = Delay(0.1) + CallFunc(label.do, Delay(3) +
> moveup + movedown)
>         return label
>
> class SplashScene(cocos.scene.Scene):
>     def __init__(self, nextsceneclass, *args, **kwargs):
>         self.next_scene_class = nextsceneclass
>         self.layers = [ByLineLayer()]
>         self.action = Delay(0.10)
>         for l in self.layers:
>             self.action += l.action
>         self.action += CallFunc(self.next_scene)
>         super(SplashScene, self).__init__(*self.layers)
>         self.do(self.action)
>         print self.action
>
>     def next_scene(self):
>         director.replace(self.next_scene_class())
>
> if "__main__" == __name__:
>     director.init(width=640, height=480)
>     director.run(SplashScene(cocos.scene.Scene))
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to