0 votes

I have a Sprite node that uses animation strips and an AnimationPlayer node that controls the animations. I have a strip 22 frames long, for the attack animation, and I want my character to be locked into the animation for the first 8 frames of the strip, meaning that no matter how much they press jump or try to move, they will still be attacking these 8 frames. After that, the player should be able to move again. How can I do that?

asked Nov 18, 2019 in Engine by selamba (138 points)

For clarity: an animation strip is a single .png file that contains different frames of the animation. If I had separate .png files, i would have used AnimatedSprite.

1 Answer

0 votes

You'll probably want to use 'actor states'. When the character begins an attack, add the attacking state to the list of active actor states (this can be done a multitude of ways, the simplest probably being a dictionary). When the character hits the frame the attack de-facto ends on, OR is interrupted mid-attack, set the attack state back to off. When checking if the player is able to perform actions like jumping, moving, etc. first check that the current blocking states are not active.

answered Nov 18, 2019 by thirite (154 points)
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 How to use this Q&A? before posting your first questions.