Aseprite 中文文档 下载 App

Aseprite 与 Godot 集成|Godot 4 原生支持 Aseprite 文件

Godot 4 原生支持 Aseprite

Godot 4 内置了 Aseprite Importer——和 Unity 一样,Aseprite 的 .ase / .aseprite 文件可以直接拖进 Godot 项目,引擎自动读取帧、标签、图层信息。

Godot 3 需要安装第三方插件(比如 Aseprite Wizard),Godot 4 已经原生内置。

怎么导入

第一步:Aseprite 里保存工程

画完动画后 File → Save 保存为 .ase 文件。

第二步:拖进 Godot

把 .ase 文件拖进 Godot 的 FileSystem 窗口。Godot 会自动:

  1. 解析文件内容
  2. 为每个标签创建一个 SpriteFrames 动画(Godot 里 SpriteFrames 是管理一组动画帧的容器)
  3. 生成 .tscn 文件(场景)和 .import 文件(导入缓存)

第三步:用 AnimatedSprite2D 播放动画

  1. 在场景里添加 AnimatedSprite2D 节点
  2. Inspector 里把 Aseprite 导入的 SpriteFrames 赋给它的 Sprite Frames 属性
  3. 点击 Play 按钮预览,或在脚本里用 $AnimatedSprite2D.play("walk") 播放指定标签

标签名就是 play() 函数的参数——play("idle")、play("attack-heavy"),和 Unity Animator 的逻辑一样。

SpriteFrames 里的动画列表

Godot 导入后,SpriteFrames 面板里会自动列出所有 Aseprite 标签:

Aseprite标签           →  Godot SpriteFrames 动画名
───────────────────────────────────────────────
idle (乒乓循环 2-4帧)  →  idle (自动设置循环模式 + 反向补帧)
walk (正向循环 6帧)    →  walk (自动设置循环 + 正向)
attack (正向不循环 5帧) →  attack (自动设置不循环 + 正向)

Godot 自动继承了 Aseprite 标签的播放模式(正向/反向/乒乓)和帧时长——不需要手动设置循环。

Godot Aseprite Wizard 插件

虽然 Godot 4 原生支持 .ase 文件,但社区有一个功能更强大的Aseprite Wizard 插件,额外提供:

自动创建 AnimTree

导入时自动生成 AnimationTree(复杂动画状态机),不需要手动搭建:

切片自动生成

如果 Aseprite 里用了 Slices 功能(身体各部位切片),插件会自动生成可独立旋转的 Sprite2D 节点:

导出辅助

导入设置详解

选中 .ase 文件,Inspector 里可以配置:

选项说明建议
Tile Size切片尺寸(如果 Aseprite 用了 Slices)和 Aseprite 里的 Slice 尺寸一致
Frame Duration帧时长保持 "From Aseprite"(继承 Aseprite 设置)
Import AsSpriteFrames / Atlas默认 SpriteFrames

对比:直接 .ase 导入 vs Sprite Sheet + JSON

方式优点缺点
直接 .ase 导入步骤最少、保留全部原始信息、可迭代修改依赖 Godot 4+ 和原生 Importer
Sprite Sheet + JSON任何 Godot 版本都能处理、通用步骤多一层、需要手动配置 SpriteFrames

推荐直接 .ase 导入——迭代开发更顺畅,改了 Aseprite 里的动画直接保存回到 Godot 就自动更新。