0 votes

I want to play an a 4 frames animation, and i have tried with this code:

func input(event):
var grounded = is
onfloor()
if grounded and Input.is
actionjustpressed("attack1"):
$AnimationPlayer.play("attack")

and i already tried in this way:

func input(event):
if Input.is
actionjustpressed("attack1"):
$AnimationPlayer.play("attack")

but my character just stop the animation and dont play the current animation to attack.

What i can try? Its just the animation thats too small??

Godot version 3.3.2
in Engine by (12 points)

Have you checked if the attack animation works as you want before running the code? Maybe the animation itself is not running properly and is just stuck at Frame 1 (hence why it appears to "stop").

The animation its working properly, but when i run this code, doesnt run even the first frame of the animation, i really dont understand whats happening

Heres my screen

if grounded:
    if move_dir == 0:
        play_anim("idle")
    else:
        play_anim("walk")
else:
    play_anim("jump")
#Bater no teto
if is_on_ceiling():
    y_velo = 0

I have that above in my code, this can be the cause?

2 Answers

0 votes

Make sure that in project settings -> input map there is an action called attack1, and it does have an action attached to it

by (248 points)
0 votes

Make sure to create an Input Map Action for attack1. Go to Project -> Project Settings -> Input Map. Type Action name then click add then add key for that action.

by (100 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 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.