This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi.

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

Can someone help to me for this?

Thank you

Godot version 3.5 stable
in Engine by (12 points)

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

https://www.youtube.com/watch?v=Y744H67BfbQ

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

1 Answer

0 votes

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

3.x and 4.x:

your_animated_sprite_ref.frames.get_frame_count()

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

by (382 points)
edited by

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.