The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

so i want to add attack feature to my game and i want to access the frame data in animated sprite, is there a way?

in Engine by (25 points)

You must have added a AnimatedSprite node to you scene right ? Like if you have a Player Scene then maybe you added AnimatedSprite node to it.
You can simply access this node and specific animation you created using it in your Player Script like this :


Of course I have assumed you named your animation "attack".

yes, but how do i take frame data like, to do damage at a specific frame

2 Answers

+2 votes
Best answer

If you just want to detect which frame is the current frame, AnimatedSprite has a frame property and a frame_changed() signal. If you actually want to get the data from the frame, you must call get_frame() on the frames (type SpriteFrames) property of the AnimatedSprite.

If you want to deal damage at a specific frame, it may be easier to use an AnimationPlayer and call the function to deal damage in the animation track instead.

by (8,550 points)
selected by

sorry im new and dont know some stuff so is there like a reference or a video explainig this

You can look at the documentation, I guess. Sorry, that's really all I look at.

tnk u for your help

0 votes

no there's no way for animatedsprite
use animationplayer instead.

by (14 points)

actually there is but tnk u anyways

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.