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.
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.
Step 2: Build the animation
Select your character and add a Sprite Animation component. It has three things to fill in:
| Field | What to put there |
|---|---|
| Name | What this animation is called — idle, run, attack. Blocks refer to it by this name later, so keep it short and obvious. |
| Interval | Seconds 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:
- Animation → your animationPick the one you just built, by the name you gave it.
- 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.
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:
| Animation | Interval | Feel |
|---|---|---|
| Idle / breathing | 0.15 – 0.25 | Calm, alive but not busy |
| Wings, flapping | ~0.19 | What Flappy Bird's bird uses |
| Run cycle | 0.08 – 0.12 | Urgent, keeps up with movement |
| Attack / fire | 0.05 – 0.08 | Snappy, over before you notice |
| Death | 0.12 – 0.2 | Slow 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 happens | Chain |
|---|---|
| Player attacks | When Screen Touched → Set Sprite (attack) |
| Player gets hit | On Play → Is Colliding With → Set Sprite (hurt) |
| Enemy spawns and walks | When Object Loads → Set 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:
- Set Spriteanimation attack
- Wait (Timer)seconds ≈ the length of the attack. Three frames at 0.06 is 0.18, so 0.2 is about right.
- 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.
When it doesn't look right
| Symptom | Cause |
|---|---|
| Nothing animates, character stands still | The Sprite component still has an Image set — clear it to None. An image always beats an animation. |
| Character freezes on one pose | Missing the Wait (Timer) and second Set Sprite back to idle |
| Animation flickers or restarts constantly | Set Sprite is on an On Play chain, so it re-triggers every frame — move it to an event that fires once |
| Movement looks like stumbling | A frame is out of order — fix with Insert Frame / Delete Frame |
| Too fast or too slow | Interval is seconds per frame — smaller is faster |
| Character faces the wrong way | Use Change Position/Size with scale x = −1 to mirror the sprite; one drawing covers both directions |
| Frames jump around | The images aren't the same size — keep every frame on the same canvas size |
| Second attack cuts short | Timer 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.