Instead of directly using the spritesheet, you can create AtlasTextures
.
An AtlasTexture
is a special kind of texture that only references another one with an optional sub-rectangle.
So yes, you can use spritesheets with AnimatedSprite, but currently the UI isn't very friendly to do so:
You need to create one AtlasTexture
for each frame of your animation. Create from the inspector, set them to use the spritesheet and choose which sub-rectangle to use, then save as a file (frame1.tres
, frame2.tres
etc for example).
Then, you'll be able to use them in your AnimatedSprite
just like regular textures.
Another way is of course to manually cut your spritesheet in an image editor. It depends which alternative you prefer.
You can also just not use AnimatedSprite
and use Sprite
directly, by playing with the hframes
, vframes
and frame
properties which you can animate either by script or by AnimationPlayer
.
Related Q&A posts:
https://godotengine.org/qa/25528/animated-sprite-individual-images-vs-sprite-spritesheet
https://godotengine.org/qa/17461/whats-the-best-way-import-sprite-sheet-into-animatedsprite