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

Module pajammin.display.sprite.sprite

Graphical widgets that defines one or more animation modes, based on images loaded from files. Sprites are constructed based on sprite categories, which define the basic types of sprites that are available.

A sprite catalog is used to register and look up sprite categories. The sprite catalog is accessed via the functions add_sprite_category() and get_sprite_category(). New categories are typically added to the sprite catalog using sprite category factory functions, such as add_walker_category.
Classes
AnimationSequence A sequence of animation frames that constitute an animation.
Sprite A graphical widget that defines one or more animation modes, based on images loaded from files.
SpriteCategory Shared information about a group of sprites that use the same set of animation sequences.

Function Summary
  get_sprite_category(name)
Search the sprite catalaog for the sprite category with the given name, and return that sprite category.
    Sprite Category Factory Functions
  add_flyer_category(name, layer, imagespecs, durations)
Add a new sprite category to the sprite catalog, that defines two animations:
  add_sitter_category(name, layer, walkspecs, walktimes, sitspecs, sittimes)
Add a new sprite category to the sprite catalog, that defines six animations:
  add_still_category(name, layer, imagespec)
Add a new sprite category to the sprite catalog, that defines a single still animation whose image is taken from imagespec.
  add_walker_category(name, layer, imagespecs, durations)
Add a new sprite category to the sprite catalog, that defines four animations:
  add_animated_category(name, layer, imagespecs, durations)
Add a new sprite category to the sprite catalog, that defines a single animation whose frames and durations are specified by imagespecs and durations.
  add_sprite_category(sprite_category)
Add a sprite category to the sprite catalog.

Function Details

add_sprite_category(sprite_category)

Add a sprite category to the sprite catalog.

add_animated_category(name, layer, imagespecs, durations)

Add a new sprite category to the sprite catalog, that defines a single animation whose frames and durations are specified by imagespecs and durations.

add_walker_category(name, layer, imagespecs, durations)

Add a new sprite category to the sprite catalog, that defines four animations:
  • walk_right -- Formed from imagespecs and durations.
  • walk_left -- Formed by reversing and flipping walk_right.
  • jump_right -- The first frame in walk_right.
  • jump_left -- The first frame in walk_left.

add_still_category(name, layer, imagespec)

Add a new sprite category to the sprite catalog, that defines a single still animation whose image is taken from imagespec.

add_sitter_category(name, layer, walkspecs, walktimes, sitspecs, sittimes)

Add a new sprite category to the sprite catalog, that defines six animations:
  • walk_right -- Formed from walkspecs and walktimes
  • walk_left -- Formed by reversing and flipping walk_right.
  • sit_right -- Formed from sitspecs and sittimes
  • sit_left -- Formed by reversing and flipping sit_right.
  • jump_right -- The first frame in walk_right.
  • jump_left -- The first frame in walk_left.

add_flyer_category(name, layer, imagespecs, durations)

Add a new sprite category to the sprite catalog, that defines two animations:
  • fly_right -- Formed from imagespecs and durations.
  • fly_left -- Formed by reversing and flipping walk_right.

get_sprite_category(name)

Search the sprite catalaog for the sprite category with the given name, and return that sprite category.