Can i use tilesets on animated sprites?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Inferno

Im using free assets to use in my game, and im trying to figure out how can i “cut” a part of the spriteset (?) , im new into game dev and its a project for school. I just want to get the player model so i can animate

i just want to get one of the frames so i can use in the animated sprite

Screenshot by Lightshot heres the link of the image
Sry guys if im confusing im really new to godot and game making in general x)

Hi, Your Talking about using Spritesheets to make an animated sprite, this is something Ive had difficulty with myself.

KaiProton | 2018-05-29 19:10

:bust_in_silhouette: Reply From: Zylann

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://forum.godotengine.org/25528/animated-sprite-individual-images-vs-sprite-spritesheet

https://forum.godotengine.org/17461/whats-the-best-way-import-sprite-sheet-into-animatedsprite