Module mooeye::sprite

source ·
Expand description

Contains a sprite struct that can be used to display animated images.

Structs

  • A Sprite is an advanced version of an image element, displaying an animated picture that can have multiple states (e.g. a walking, attacking, etc. version of a player character) The sprite is initalized using an image file that contains multiple rows of images (each row representing a variant), where each row contains the same number of animation frames for each variant. Drawing the sprite repeatedly draws every frame of the selected variant in order and then repeats from the beginning.
  • A pool that contains a number of initialized Sprites at once and can be passed around and allows initialization of sprites using the prototype pattern and without having to re-access the file system or pass around a loading context. Provides functions for quickly initalizing folders of sprites and access methods similar to those of graphics::Image and Sprite.