Sprite total frame count

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


I need total frame count in Sprite.
I using Sprite with AnimationPlayer.

Can someone help to me for this?

Thank you

I’m not sure I understand the question, here. Try this, maybe he’ll cover it:


CassanovaWong | 2022-09-20 09:52

Thank you for comment, but i wrote this below, i need frames total counts and in this video he explaining general things, but again thank you for your answer

leafray | 2022-09-21 14:50

:bust_in_silhouette: Reply From: BoxyLlama

There is a way to get the frame count using get_frame_count.

3.x and 4.x:


This will return the number of frames in the current animation.

Thank you,
but this is related with AnimatedSprite, this cant work in normal Sprite.

generally i can use $Sprite.hframes * $Sprite.vframes

i have 8 frames, if i will export sprites with packed then i will get 3 * 3 = 9, but i dont need last frame
i can use spritesheet with packed but i need use like this, $Sprite.hframes * $Sprite.vframes - 1
i can use spritesheet 1 row and 8 column or reverse, ( 1 * 8 = 8 ).
or i using AnimationPlayer and have 0.1 second between every frame, i can get $AnimationPlayer.current_animation_length

leafray | 2022-09-21 14:38