Attack_animation_finished(): dont appears in the function at the animation

4
Im following the HearthBeast tutorial for an rpg (https://www.youtube.com/watch?v=0nd1zNiy0C4) and i cant do the step of the minute 20:40 when him ends the attack animation putting a function called attack_animation_finished(): in the animation player. But when i try to type the same option dont shows to me and i dont understand why.

make sure you save (Ctrl+s) first, save the Player.gd

1 Like

i already had tried that i even reopen godot a couple of times and is not working this is my code i had to change some things because the tutorial that im seeing is working on godot 3 and some things had changed. Im learning to code so probably make some dumb mistake if you could help me see whats is wrong i would appreciate it

Script del Mundo
extends CharacterBody2D

const ACELERACION = 500
const VEL_MAX = 80
const FRICCION = 500

enum {
MOVE,
ROLL,
ATTACK
}
var state = MOVE
@onready var anim = $AnimationPlayer
@onready var arbolanimaciones = $AnimationTree
@onready var ESTADO_DE_LA_ANIMACION = arbolanimaciones.get(“parameters/playback”)

#ATAQUE
func _physics_process(delta):
match state:
MOVE:
_move_state(delta)
ROLL:
pass
ATTACK:
attack_state(delta)

	#movimiento

func _move_state(delta):
var input_vector = Vector2.ZERO
input_vector.x = Input.get_action_strength(“ui_right”) - Input.get_action_strength(“ui_left”)
input_vector.y = Input.get_action_strength(“ui_down”) - Input.get_action_strength(“ui_up”)
input_vector = input_vector.normalized()
move_and_slide()
if input_vector != Vector2.ZERO:
arbolanimaciones.set(“parameters/PARADO/blend_position”, input_vector)
arbolanimaciones.set(“parameters/Caminar/blend_position”, input_vector)
arbolanimaciones.set(“parameters/Attack/blend_position”, input_vector)
ESTADO_DE_LA_ANIMACION.travel(“Caminar”)
velocity = velocity.move_toward(input_vector * VEL_MAX, ACELERACION * delta)
else:
ESTADO_DE_LA_ANIMACION.travel(“PARADO”)
velocity = velocity.move_toward(Vector2.ZERO, FRICCION * delta)

	#ATAQUE
if Input.is_action_just_pressed("Attack"):
	state= ATTACK

func attack_state(delta):
ESTADO_DE_LA_ANIMACION.travel(“Attack”)

func attack_animation_finished():
state = MOVE