0 votes

Goodday,

When I press Attack key, the attack animation still sliding during animation event I set vector x is 0. It only stopped at moment but not after animation finish. I try to find signal at Animation Tree, but cant find finish travel states or etc. .

Here script:
extends KinematicBody2D

var state_machine
var velocity = Vector2(0,0)
var isAttacking = false

const playerspeed = 500
const player
gravity = 30
const player_jump = 700

func ready():
state
machine = $AnimationTree.get("parameters/playback")

func physicsprocess(delta):
if isonfloor():
if Input. isactionpressed("moveright"):
velocity.x = player
speed
statemachine.travel("run")
$Sprite.flip
h = false
if Input. isactionjustpressed("movejump"):
velocity.y = -playerjump
elif Input. is
actionpressed("moveleft"):
velocity.x = -playerspeed
state
machine.travel("run")
$Sprite.fliph = true
if Input. is
actionpressed("movejump"):
velocity.y = - playerjump
elif Input. is
actionpressed("movejump"):
velocity.y = - playerjump
elif Input. is
actionjustpressed("movejump"):
velocity.y = - player
jump
else:
state_machine.travel("idle")

    if Input. is_action_pressed("attack_1"):
        velocity.x = 0
        state_machine.travel("punch")

here the preview:
https://media.giphy.com/media/j09HyRDf5y8VU1VObi/giphy.gif

Godot version v3.2.3
in Engine by (14 points)

Please log in or register to answer this question.

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.
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 webmaster@godotengine.org with your username.