the state actually showing right now - 'action' overrides idle/move while it plays
Plays an action animation once - an attack, a use-item flourish, a wave. Idle/move resumes automatically when it finishes.
Optionalvariant: stringreplay from the first frame even if this action is already playing; without it, a second call while one is already running is a no-op
Standing still or moving, and which way. Has no effect while an action is playing - the request is remembered and taken up the moment it finishes.
Optionalvariant: string
The convention
AnimatedSpriteandGridMovernever had: standing still, moving, and performing an action are the only three states a character's animation is ever in, and an action is the only one of the three that interrupts the other two rather than being interrupted by them.setMovingtoggles between idle and move freely, as often as every frame - a grid character's walk cycle calls it once perupdate.playActioncuts in over whichever of those is currently showing, plays once, and - because an action animation must be registered non-looping ({ loop: false }) for this to close the loop - hands control back to idle or move automatically the instant it finishes, picking up whicheversetMovingcalls arrived while it was playing rather than whatever was true when it started. A secondplayActionwhile one is already running is ignored unlessrestartis passed, so an attack animation is not stuttered by a turn resolving faster than its swing.This owns the sprite's
onFinishhook entirely; a game driving one throughActorAnimatorshould not also setonFinishitself.Example