How do I select part of a image for a sprite?

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

I have a lot of items and I would rather have a spritesheet than 500 png images. In the item dictionary I can specify the Vector2() for the top left corner and Vector2() for the bottom left corner for the part of the spritesheet I want. If this achievable how can I do this?

:bust_in_silhouette: Reply From: inTech

If you have a Spritesheet as the Texture property of a Sprite node. Then you just need to adjust the VFrame and HFrame properties under the Animation tree.

Additionally, you can adjust the animation using an AnimationPlayer or via code (by changing the VFrame and HFrame property).

enter image description here

Thanks for the answer, it is working great!

jujumumu | 2019-07-26 16:20

:bust_in_silhouette: Reply From: Zylann

If your texture is not exactly a spritesheet you can still change the region, see the Region category in the inspector when your sprite is selected.
If you use the same region often, you can make it an AtlasTexture as well.