Godot 4: SpriteFrames from a Sprite Sheet (Complete Guide)

You have a sprite sheet. Godot 4 has at least three ways to turn it into an animation, and they are not interchangeable. Pick the wrong one and you will spend an evening wondering why the character is blurry, why the frames are out of order, or why nothing plays at all.

This guide covers the three paths, the import settings that matter, and the failure modes that are easy to misdiagnose.

Choose the right path

Path Best for Trade-off
AnimatedSprite2D + SpriteFrames Character loops, props, UI Simplest; one node, one resource
Sprite2D + AnimationPlayer Animation that must sync with other tracks (hitboxes, SFX, VFX) More setup; more control
AtlasTexture + AnimationPlayer Packed atlases with non-grid regions Precise; verbose

If you just need “play a walk cycle,” use AnimatedSprite2D. If the animation must trigger a sound on frame 3 or toggle a hitbox on frame 5, use AnimationPlayer.

Prepare the sheet before importing

Godot does not fix a bad sheet. Check these first:

If you are starting from an AI video, the video to sprite sheet tool produces a grid sheet and a JSON with one rect per frame.

Import settings that actually matter

Select the PNG in the FileSystem dock and open the Import tab.

Setting Pixel art Painted art
Filter Off On
Mipmaps Off Off (unless you see shimmer at distance)
Compress Mode Lossless Lossless or VRAM Compressed
Detect 3D Off Off

Why:

After changing import settings, click Reimport.

Method A — SpriteFrames in the editor

This is the fastest path and the one most tutorials show.

  1. Add an AnimatedSprite2D to the scene.
  2. In the Inspector, find Sprite Frames, click New SpriteFrames.
  3. Click the new resource to open the SpriteFrames editor at the bottom of the screen.
  4. Add an animation, name it idle, set Speed to 10–12, enable Loop.
  5. Click Add frames from sprite sheet (the grid icon).
  6. Choose the PNG. Set Horizontal and Vertical to the grid dimensions.
  7. Select the cells you want. For a single animation strip, select all; for a multi-row sheet, select one row at a time and name the animation accordingly.
  8. Click Add frames.

The result is a SpriteFrames resource stored inside the scene (or saved as a .tres if you choose Save As).

The dialog adds frames in reading order. If the order looks wrong, the columns/rows are wrong, or the sheet was packed in a different order.

Method B — Generate a .tres

If you already have frame rects in JSON, generating the resource is faster and less error-prone than clicking cells.

Use the SpriteFrames generator:

  1. Load the PNG (for preview and validation).
  2. Load the JSON (TexturePacker, Phaser, or the JSON from the video tool).
  3. Set the animation name or split by prefix (idle_00, walk_00).
  4. Set the speed and loop.
  5. Download the .tres.

Put the .tres next to the PNG in your project. The ext_resource path must match the real location:

res://assets/hero/hero.png

Assign the resource to an AnimatedSprite2D via Sprite Frames, then call play("idle").

What is inside the .tres

A minimal two-frame resource looks like this:

[gd_resource type="SpriteFrames" load_steps=4 format=3]

[ext_resource type="Texture2D" path="res://hero.png" id="1_sheet"]

[sub_resource type="AtlasTexture" id="AtlasTexture_0"]
atlas = ExtResource("1_sheet")
region = Rect2(0, 0, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_1"]
atlas = ExtResource("1_sheet")
region = Rect2(64, 0, 64, 64)

[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1")
}],
"loop": true,
"name": &"idle",
"speed": 10.0
}]

Each AtlasTexture points at one region of the same PNG. speed is the animation FPS; duration is a multiplier relative to that speed. A duration of 1.0 at speed 10.0 means each frame lasts 0.1 s.

Method C — Sprite2D + AnimationPlayer

Use this when the animation must drive other things.

  1. Add a Sprite2D.
  2. Set Hframes and Vframes to the grid dimensions.
  3. Add an AnimationPlayer.
  4. Create an animation, for example idle.
  5. Add a track for the Sprite2D’s frame property.
  6. Insert keys 0, 1, 2, … at the timing you want.
  7. Set the track’s update mode to Discrete (not continuous).
  8. Enable looping on the animation.
extends Node2D

@onready var player: AnimationPlayer = $AnimationPlayer

func _ready() -> void:
    player.play("idle")

For packed atlases with non-grid regions, animate the region property of an AtlasTexture instead, or swap texture per key. That is more verbose but works with any rect layout.

Playing and timing

extends AnimatedSprite2D

func _ready() -> void:
    sprite_frames.set_animation_speed("idle", 12)
    play("idle")

func _on_hit() -> void:
    play("attack")
    # Return to idle when the attack finishes.
    await animation_finished
    play("idle")

Useful properties:

If the animation plays too fast or too slow, fix the speed in the SpriteFrames resource first; use speed_scale for runtime effects (slow motion, haste).

Troubleshooting

Symptom Likely cause Fix
Nothing plays No SpriteFrames assigned, or wrong animation name Assign the resource; check the name in play("...")
Plays but is invisible Node hidden, z-index, or offset moved it off-screen Check visibility and offset
Blurry pixels Filter on, or frames upscaled Turn Filter off; extract at native size
Lines between frames No padding/extrude, mipmaps on Add padding 2 + extrude 1; disable mipmaps
Frames out of order Wrong columns/rows or wrong frame order Fix the grid, or use JSON rects
Character jitters Per-frame trim or changing pivot Rebuild with uniform bounds; use one node offset
Animation too fast Speed set to the video FPS (e.g., 30) Set the game FPS (10–12)
Huge memory spike 4096+ sheet with many frames Lower FPS/frame size; split animations

A note on pivots

Godot’s AnimatedSprite2D does not store a per-frame pivot. It uses the node’s centered flag and offset. That is why consistent frame bounds matter: one node offset has to work for every frame. If the source frames drift, fix the sheet, not the node.

FAQ

Do I need a .tres, or can I use the editor? Either works. The editor path is fine for one-off sheets; a generated .tres is faster when you already have frame data and want repeatable exports.

Can I use a packed atlas instead of a grid? Yes, with AtlasTexture regions. The editor’s “Add frames from sprite sheet” expects a grid, so packed atlases are easier with generated resources or AnimationPlayer.

Why does my 64×64 pixel art look soft? Filter is on, or the sheet was upscaled. Set Filter off, Mipmaps off, and reimport. Also check that the sprite is not scaled by a non-integer factor.

How do I loop an attack animation twice? Use play("attack") twice, or set the animation to loop and control it with speed_scale/signals. For one-shot actions, keep loop off and return to idle on animation_finished.

Does the JSON pivot from other tools matter in Godot? Not directly. Use it to design consistent bounds; in Godot, set the node offset. Other engines (Unity, Phaser) read pivot from metadata.


If you are starting from an AI video, go to How to turn AI video into a game-ready sprite sheet first. If you already have a sheet and JSON, the SpriteFrames generator will produce the resource.