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

Class SpriteCategory


Shared information about a group of sprites that use the same set of animation sequences.
Method Summary
  __init__(self, name, default_layer, animations)
  animation(self, name)
Return the animation sequence with the given name, or the default animation if no name is given.
  has_animation(self, animation_name)
  icon(self)
Return a single image that can be used as an icon for this category.
  load_images(self)

Instance Variable Summary
  default_layer: The default layer for sprites in this category.
  name: The name of this sprite category.

Class Variable Summary
bool images_loaded = False

Method Details

__init__(self, name, default_layer, animations)
(Constructor)

Parameters:
default_layer - The default layer for sprites in this category.
animations - A list of the animation sequences that sprites in this category can use. The first animation in this list is considered the default animation. Each animation sequence should have a different name.

animation(self, name=None)

Returns:
The animation sequence with the given name, or the default animation if no name is given. If the animation sequence has not loaded its images yet, then its images will be loaded first.

Requires: The pygame display must be initialized.

has_animation(self, animation_name)

icon(self)

Returns:
A single image that can be used as an icon for this category. This image is taken from the first frame of the default animation.

Requires: The pygame display must be initialized.

load_images(self)


Instance Variable Details

default_layer

The default layer for sprites in this category.

name

The name of this sprite category. Every sprite category should have a different name.

Class Variable Details

images_loaded

Type:
bool
Value:
False