AutoSprite

Godot Integration

Import AutoSprite spritesheets into Godot 4.x using AnimatedSprite2D and SpriteFrames.

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:

  1. Click + Add Animation in the SpriteFrames panel
  2. Name it (e.g., "walk", "run", "jump")
  3. Click the grid icon to add frames from spritesheet
  4. Set columns and rows to match your layout
  5. Click frames to select them in order
  6. Click Add Frames

Frame Import Settings

When importing from a spritesheet:

SettingDescription
HorizontalNumber of columns in spritesheet
VerticalNumber of rows in spritesheet
FrameIndividual frame selection
ClearClears current selection
✨
Pro Tip:

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

PropertyRecommended Setting
Sprite FramesYour SpriteFrames resource
AnimationDefault animation ("idle")
PlayingUsually false (controlled by code)
Flip HFor horizontal mirroring
Flip VRarely 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_up
  • walk_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

✨
Pro Tip:

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:

SettingPixel ArtHD Art
FilterNearestLinear
MipmapsOffOn
RepeatDisabledDisabled

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 Discord

Our community can help with Godot-specific questions!