Package pajammin :: Package display :: Package sprite :: Module sprite :: Class AnimationSequence
[show private | hide private]
[frames | no frames]

Class AnimationSequence


A sequence of animation frames that constitute an animation. Each animation frame consists of an image that should be displayed during that frame, and a duration specifying how long the frame should be displayed (measured in an abstract unit called 'ticks'). Every image in an animation sequence must have the same size.

Every animation has an anchor, which is the position that should be considered the 'center' fo the animation. When a sprite changes from one animation to another, the anchor of the new animation will be placed at the same location as the anchor of the old animation.
Method Summary
  __init__(self, name, imagespecs, durations, loop, next, default_speed, anchor_offset, fliphoriz, flipvert, reverse, rotate)
Create a new animation sequence.
  duration(self)
  load_images(self)
Load the images that were specified by the imagespecs passed to the constructor.

Instance Variable Summary
  anchor_offset: The distance from the animation's anchor to the position (width/2, height/2).
  default_speed: The default animation speed for this animation sequence.
  durations: A list containing the duration of each animation frame, in ticks.
  images: A list containing the image for each animation frame.
  imagespecs: Image specifications for the images used by this frame.
  loop: A flag indicating whether the animation should loop back to the beginning after it reaches the last frame.
  name: The name of this animation sequence.
  next: The animation sequence to go to after this one finishes (only used if loop=False).
  size: The size of the images used by this animation frame.

Method Details

__init__(self, name, imagespecs, durations=None, loop=True, next=None, default_speed=1, anchor_offset=(0, 0), fliphoriz=False, flipvert=False, reverse=False, rotate=0)
(Constructor)

Create a new animation sequence.
Parameters:
imagespecs - A list of image specifications, specifying the image that should be used for each animation frame.

duration(self)

load_images(self)

Load the images that were specified by the imagespecs passed to the constructor. This should be called after the pygame display has been initialized.

Instance Variable Details

anchor_offset

The distance from the animation's anchor to the position (width/2, height/2).

default_speed

The default animation speed for this animation sequence.

durations

A list containing the duration of each animation frame, in ticks.

images

A list containing the image for each animation frame. This variable is initialized by load_images.

imagespecs

Image specifications for the images used by this frame.

loop

A flag indicating whether the animation should loop back to the beginning after it reaches the last frame.

name

The name of this animation sequence.

next

The animation sequence to go to after this one finishes (only used if loop=False).

size

The size of the images used by this animation frame. This variable is initialized by load_images.