Skip to main content

Module sprite_anim

Module sprite_anim 

Source
Expand description

Sprite Animation System — frame-by-frame ASCII art animation.

Provides a SpriteAnimator that drives frame-based animations for entities in the Chaos RPG. Each animation is a sequence of SpriteFrames, where each frame is a collection of positioned, colored glyphs forming the ASCII art.

§Architecture

SpriteAnimator
  ├─ animations: HashMap<String, SpriteAnimation>
  ├─ current: String (active animation name)
  ├─ frame_index: usize
  ├─ frame_timer: f32
  └─ state_machine: AnimationStateMachine
        ├─ states: HashMap<String, AnimState>
        ├─ transitions: Vec<AnimTransition>
        └─ params: HashMap<String, f32>

§Pre-built Animations

The module includes ready-to-use animations for:

  • Player: idle, attack, cast, hurt, defend
  • Enemy: idle, attack, death
  • Bosses: unique idle and attack per boss type

Structs§

AnimEvent
Events emitted by the animator during playback.
AnimState
A state in the animation state machine.
AnimTransition
A transition between animation states.
AnimationLibrary
Pre-built animation library for the Chaos RPG.
AnimationStateMachine
Simple animation state machine.
FrameGlyph
A single glyph within a sprite frame, positioned relative to entity center.
SpriteAnimation
A named animation consisting of ordered frames.
SpriteAnimator
Drives frame-by-frame sprite animations with an optional state machine.
SpriteFrame
A single frame of a sprite animation — the complete ASCII art for one pose.

Enums§

AnimCondition
Condition for transitioning between animation states.
LoopMode
How an animation repeats.