Class ActorAnimator
Chooses an Actor's animation frame from its MovementState: the
presentation half of Corgi Engine's animator parameters.
Each state maps to a Clip of frame indices in a sprite sheet. A state with
no clip of its own borrows a related one -- running falls back to walking,
crawling to crouching, every airborne state to jumping or falling, and in the
end everything to idle -- so a character drawn with only idle, walk and jump
frames still animates sensibly. One animator can serve every actor of a kind;
the per-actor progress lives in a Track.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA run of frames.static final classOne actor's place in its animation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclipFor(MovementState state) The clip a state shows, borrowed if it has none.intframeFor(ActorAnimator.Track track) The frame for a track.set(MovementState state, int ticksPerFrame, boolean loop, int... frames) Sets a state's clip from frames.set(MovementState state, ActorAnimator.Clip clip) Sets a state's clip.
-
Constructor Details
-
ActorAnimator
public ActorAnimator()
-
-
Method Details
-
set
Sets a state's clip.
Parameters
state: the stateclip: its clip, or null to borrow a related one
Returns
this animator
-
set
Sets a state's clip from frames.
Parameters
state: the stateticksPerFrame: ticks each frame showsloop: whether it repeatsframes: the sheet frame indices
Returns
this animator
-
clipFor
The clip a state shows, borrowed if it has none.
Parameters
state: the state
Returns
the clip, or null if not even idle has one
-
frameFor
The frame for a track.
Parameters
track: the actor's track
Returns
the sheet frame index, 0 if nothing is set
-