This guide covers importing AutoSprite exports into Godot 4.x using AnimatedSprite2D.
Need to generate the asset first? Start with the Godot sprite sheet generator workflow, then use this guide for SpriteFrames setup and import details.
Want this automated? The AutoSprite Godot Extension adds a dock to the editor that browses your characters and builds the SpriteFrames + AnimatedSprite2D scene for you in one click.
Quick Start
Add Files to Project
Copy your PNG spritesheet into your Godot project's folder (e.g., res://assets/characters/).
Create AnimatedSprite2D
Add an AnimatedSprite2D node to your character scene.
Create SpriteFrames
In the AnimatedSprite2D inspector:
- Click the Sprite Frames property
- Select New SpriteFrames
- Click to open the SpriteFrames editor
Import Frames
In the SpriteFrames panel:
- Rename "default" to your first animation (e.g., "idle")
- Click the grid icon (Add frames from sprite sheet)
- Select your spritesheet
- Set grid dimensions to match frame size
- Select frames for this animation
- Repeat for each animation
Detailed Setup
SpriteFrames Resource
SpriteFrames is Godot's way of organizing sprite animations. Each SpriteFrames resource can contain multiple animations.
Creating animations:
- Click + Add Animation in the SpriteFrames panel
- Name it (e.g., "walk", "run", "jump")
- Click the grid icon to add frames from spritesheet
- Set columns and rows to match your layout
- Click frames to select them in order
- Click Add Frames
Frame Import Settings
When importing from a spritesheet:
| Setting | Description |
|---|---|
| Horizontal | Number of columns in spritesheet |
| Vertical | Number of rows in spritesheet |
| Frame | Individual frame selection |
| Clear | Clears current selection |
The JSON atlas from AutoSprite tells you the frame dimensions and count. Use the columns and frameCount values to set up your grid.
Animation Properties
For each animation in SpriteFrames:
- Loop - Toggle for looping animations (idle, walk, run)
- Speed - Frames per second (default 5, try 12-24)
- Frame order - Drag to reorder frames
Node Setup
Your character scene hierarchy:
CharacterBody2D
├── AnimatedSprite2D
├── CollisionShape2D
└── ... (other nodes)
AnimatedSprite2D Properties
| Property | Recommended Setting |
|---|---|
| Sprite Frames | Your SpriteFrames resource |
| Animation | Default animation ("idle") |
| Playing | Usually false (controlled by code) |
| Flip H | For horizontal mirroring |
| Flip V | Rarely needed |
GDScript Example
Here's how to control animations in GDScript:
extends CharacterBody2D
@onready var animated_sprite = $AnimatedSprite2D
var speed = 200.0
var jump_velocity = -400.0
func _physics_process(delta):
# Handle gravity
if not is_on_floor():
velocity.y += 980 * delta
# Handle jump
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = jump_velocity
animated_sprite.play("jump")
# Get movement input
var direction = Input.get_axis("move_left", "move_right")
if direction:
velocity.x = direction * speed
# Flip sprite based on direction
animated_sprite.flip_h = direction < 0
# Play walk or run animation
if is_on_floor():
if Input.is_action_pressed("run"):
animated_sprite.play("run")
else:
animated_sprite.play("walk")
else:
velocity.x = move_toward(velocity.x, 0, speed)
if is_on_floor():
animated_sprite.play("idle")
move_and_slide()
func attack():
animated_sprite.play("attack")
# Wait for animation to finish
await animated_sprite.animation_finished
animated_sprite.play("idle")
Handling Directions
For 4-directional movement (top-down games):
extends CharacterBody2D
@onready var animated_sprite = $AnimatedSprite2D
var facing_direction = "down"
func update_animation(direction: Vector2):
if direction.length() > 0:
# Determine facing direction
if abs(direction.x) > abs(direction.y):
facing_direction = "right" if direction.x > 0 else "left"
else:
facing_direction = "down" if direction.y > 0 else "up"
animated_sprite.play("walk_" + facing_direction)
else:
animated_sprite.play("idle_" + facing_direction)
This requires naming your animations:
idle_down,idle_left,idle_right,idle_upwalk_down,walk_left,walk_right,walk_up- etc.
Alternative: Sprite2D + AnimationPlayer
If you prefer AnimationPlayer over AnimatedSprite2D:
Add Sprite2D
Use a regular Sprite2D node instead of AnimatedSprite2D.
Configure Sprite2D
- Set Texture to your spritesheet
- Enable Region and set to first frame
- Set Hframes and Vframes to match your grid
Add AnimationPlayer
Create animations by keyframing the Frame property over time.
This method gives you more control over animation events and blending.
Import Tips
For pixel art, set Filter to "Nearest" in the import settings to keep sprites crisp.
Import Settings (FileSystem)
Select your spritesheet in Godot's FileSystem and check the Import tab:
| Setting | Pixel Art | HD Art |
|---|---|---|
| Filter | Nearest | Linear |
| Mipmaps | Off | On |
| Repeat | Disabled | Disabled |
Click Reimport after changing settings.
Common Issues
Sprites look blurry:
- Set Filter to "Nearest" in import settings
- Disable mipmaps
Animation speed is wrong:
- Adjust FPS in SpriteFrames panel
- 12 fps is good for pixel art
Frames in wrong order:
- Drag frames in SpriteFrames editor to reorder
- Or re-import selecting frames in correct order
Learn More
Need Help?
Join DiscordOur community can help with Godot-specific questions!
