Animation
An animation clip changes properties of a node and its children over time: sprite frames, colors, transforms, script fields. An Animation Player plays one clip and reports its events to scripts.
Clip time, gameplay events and every track except the transform pose move on fixed steps, like physics. A replay of the same input gives the same frames, events and state hash at any frame rate.
func OnAnimEvent(id int, payload float) {
if anim.EventName(id) == "Hit" {
node.Child("Sword").Get<Hitbox2D>().Pulse()
}
}
- Clips A clip is an
.aeanimfile in the assets folder. - Animation Player Animation Player plays its Clip, from the start of Play when Play On Start is set.
- Time and authority A player in game time advances on fixed steps and stops while the game is paused.
- Events Events are declared in Project Settings → Animation, or in
project.aego: - Animator An Animator plays the states of a controller, an
.aectrlfile: each state has a clip, and transitions switch between states when parameters change. - Controllers Every fixed step the animator advances its states, then looks for a transition: first the
anytransitions in their order, then those of the current state. - Root motion A clip may move the character itself: its root track is
track "" prop="transform.position" kind=vec2 root=true. - Go
sdk.AnimationOf(ctx)returns the service of the play world;SetParam(node, name, value)sets a parameter of an Animator by name,trueandfalseas 1 and 0. - Attack with a hit frame The damage of an attack belongs to one frame of its clip, not to the button press: put a gameplay event on that frame and pulse a hitbox when it arrives.
- The Animation panel Window → Animation edits the clip of the selected node's Animation Player, or the clips of its Animator's controller.
- Sprite sheets and flipbooks Select a PNG in Assets to open its inspector: the sheet with its cells.
- The Animator panel Window → Animator shows the controller of the selected node's Animator as a graph: one box per state, the Entry pill pointing at the state the Animator starts in, and the Any State pill for transitions that may leave any state.