That does sound better than what I was going to try: To load all the sequences as pyglet animation objects and somehow add / remove them from a batch (just let play whatever frame is on.)

       - _update_animation(dt) -> advances animation time, calc if a new
image is needed, if so update the actor image
Who is calling this? Do you mean something like Layer.schedule(actor.update)

and

def update(dt):
    duration += dt
    if duration == frame_rate:
        self.advance_animation(sequence.next())



    - Have an adequate data structure to hold the animation description,
usually a dict with sequence name as key ( 'idle', 'walk_left', etc ) and a
list of tuples with ( frame_duration, frame_info ).
      frame_info at least needs to specify which image is needed, but may
have extra info like dimensions of collision rect.
      A minimal data example may look as
      anim_data = {
         'idle': [(0, 'player_idle'), ],
         'walk_left': [(0.1, 'walk_left_1'), (0.1, 'walk_left_2'), ...],
         ...
      }
How is the sprite ultimately produced in cocos? If I understand what you mean, the 'walk_x' will maybe be textures from a pyglet texture grid.

Something like

def advance_frame(texture):
    self.batch.remove(previous)
    self.batch.add(texture)

I don't think I've understood (and I haven't tested anything yet) but this does not seem very smooth. Would you please elaborate on these questions a bit more? All I know is that the sprites must exist in a batch when they are shown, or else the cocos app quickly suffers reduced frame rate.

















--
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/groups/opt_out.

Reply via email to