Guide

How to animate a character

A character that stands perfectly still looks like a placeholder. A character that breathes, runs and swings looks like a game. In Max2D that difference is two things: an animation, which loops a set of frames on its own, and a Set Sprite block, which switches between animations. The first needs no scripting whatsoever. The second is a single block.

The whole idea in two sentences An animation is a named list of frames living on your object — idle, run, attack — and it plays by itself. A Set Sprite block picks which one is playing right now.

Step 1: Get your frames

An animation is just separate images shown in order. A walk cycle is often four; an idle can be two. You need them as individual images, not one strip.

  • Asset Store. Inside Max2D, character packs usually arrive with their frames already separated and sensibly named — run_1, run_2, and so on.
  • Your gallery. Import frames you drew elsewhere.
  • The sprite editor. Draw frame one, duplicate it, move an arm, save as frame two. Two frames is enough to make something feel alive.
Two frames beat none You don't need eight frames of beautiful animation. A character that bobs between two poses reads as alive from the first second, and you can refine later. Start with two.

Step 2: Build the animation

Select your character and add a Sprite Animation component. It has three things to fill in:

FieldWhat to put there
NameWhat this animation is called — idle, run, attack. Blocks refer to it by this name later, so keep it short and obvious.
IntervalSeconds per frame. Smaller is faster. Start at 0.15.
Frame 1, 2, 3…Your images, in order. Use Add Frame for each one.

Order matters and the order you add them is the order they play. If your run cycle looks like it's stumbling, a frame is out of place — Insert Frame and Delete Frame let you fix it without starting over.

Step 3: Make it play

Adding the animation doesn't show it yet. Open the character's Sprite component. It has two fields that matter, and you need both of them:

  1. Animation → your animationPick the one you just built, by the name you gave it.
  2. Image → NoneSet the Image field to None. This step is not optional, and skipping it is the single most common reason an animation refuses to play.
The image always wins If the Sprite component has an image and an animation, the engine draws the image and ignores the animation completely. It only looks at the animation when Image is set to None. So a character with both set just stands there, perfectly still, looking exactly like a broken animation — when in fact the animation is fine and simply never gets a turn.

Press play. Your character is now animating, and you haven't touched a single scripting block. For an idle loop on a background character, this is the entire job — you're done.

Worth knowing for later: when you switch animations with a Set Sprite block, it clears the image for you automatically. The manual "Image → None" step is only needed here, when you set the first animation up by hand.

Step 4: Pick an interval that feels right

Interval is the only number here, and it changes the personality of the movement more than the drawings do. Rough starting points:

AnimationIntervalFeel
Idle / breathing0.15 – 0.25Calm, alive but not busy
Wings, flapping~0.19What Flappy Bird's bird uses
Run cycle0.08 – 0.12Urgent, keeps up with movement
Attack / fire0.05 – 0.08Snappy, over before you notice
Death0.12 – 0.2Slow enough to register

Don't calculate these. Set one, play, adjust. Your eye is far better at this than arithmetic.

Step 5: More than one animation

Add a second Sprite Animation component for the next state — run, attack, hurt, whatever your character does. Give it its own Name and its own frames.

One object can hold as many as you need. A character in a finished shooter might carry seventeen: idle, run, jump, fire, shelter, hurt and die, one set per weapon. They cost nothing while they're not playing.

Step 6: Switch between them

This is where the one block comes in. Add a Set Sprite block, and in its animation field choose the animation you want to switch to.

Hang it off whatever should cause the change:

When this happensChain
Player attacksWhen Screen TouchedSet Sprite (attack)
Player gets hitOn PlayIs Colliding WithSet Sprite (hurt)
Enemy spawns and walksWhen Object LoadsSet Sprite (run)

Step 7: Go back to idle

Here's the part everyone misses. Set Sprite changes the animation and leaves it there. Switch to an attack and your character attacks forever.

A one-shot animation needs three blocks, not one:

  1. Set Spriteanimation attack
  2. Wait (Timer)seconds ≈ the length of the attack. Three frames at 0.06 is 0.18, so 0.2 is about right.
  3. Set Sprite, on the timer's async portanimation idle

That's the pattern behind every animated character you've played: switch, wait, switch back. Chain the timer's async port rather than its green arrow — that's the one that fires when the wait finishes.

Set the timer's cancel to true for repeatable actions If the player can attack again before the first attack finishes, switch cancel on. It throws away the old timer instead of letting both fire, which otherwise drops your character back to idle in the middle of the second swing.

When it doesn't look right

SymptomCause
Nothing animates, character stands stillThe Sprite component still has an Image set — clear it to None. An image always beats an animation.
Character freezes on one poseMissing the Wait (Timer) and second Set Sprite back to idle
Animation flickers or restarts constantlySet Sprite is on an On Play chain, so it re-triggers every frame — move it to an event that fires once
Movement looks like stumblingA frame is out of order — fix with Insert Frame / Delete Frame
Too fast or too slowInterval is seconds per frame — smaller is faster
Character faces the wrong wayUse Change Position/Size with scale x = −1 to mirror the sprite; one drawing covers both directions
Frames jump aroundThe images aren't the same size — keep every frame on the same canvas size
Second attack cuts shortTimer cancel is off, so the earlier timer is still running

Where to use it next

  • Give an enemy a walk cycle. Enemies that slide look wrong; the same frames at 0.1 fix it instantly.
  • Animate the pickup, not just the hero. A coin that spins draws the eye better than any arrow.
  • Animate on death. Set Sprite to a death animation, Wait, then Destroy Object — far better than vanishing.
  • Idle is where the personality goes. Two frames of a character shifting their weight does more work than a whole run cycle.

Building something to animate? Start with a game in 2 minutes, add spawning with the shooter guide, or see animation in a finished game in Flappy Bird — its bird is a three-frame animation at 0.193.

Frequently asked questions

How do I animate a sprite?

Add a Sprite Animation component, give it a name, set the interval, and add your frames in order. Then in the Sprite component choose that animation and set the Image field to None — an image takes priority over an animation, so leaving one set means nothing moves. It then loops on its own, with no blocks needed.

Can one character have several animations?

Yes, as many as you need. Each is its own Sprite Animation component with its own name, and they cost nothing until something switches to them.

How do I switch between animations?

A Set Sprite block with the animation's name in its animation field, hung off whatever should trigger the change.

Why is my character stuck on the attack animation?

Set Sprite switches and leaves it. Follow it with a Wait (Timer) about as long as the attack, then a second Set Sprite back to idle, wired to the timer's async port.

Why is my animation not playing?

Almost always because the Sprite component still has an Image selected. The engine checks for an image first and only falls back to the animation when Image is None, so an object with both draws the static picture and never animates.

What interval should I use?

Seconds per frame, so smaller is faster. Roughly 0.15–0.2 for idle, 0.08–0.12 for a run, 0.05–0.08 for an attack. Set it, play it, adjust.

Make something move tonight

Two frames and one component. Free on Google Play.

Free onGoogle Play