Animation not found for certain animations

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By WinterStep

Hello, I’ve just started working on a 2D top-down ARPG prototype, and have recently added some basic animations to test my player character. My movement and idle work, but my attack animations give me an error every frame the button is pressed:

The problem is that the way I’m setting the attack animations is similar if not the same as the movement and idle animations. I double checked the animation names too, and they match.

NOTE: facing is a variable that was inherited. It stores the ‘direction’ of movement/animation
Here is an example of my attack code:

func input_actions():
	if Input.is_action_pressed("attack_1"):

Here is an example of my movement and idle code:

	#Is Idle?
	if velocity == Vector2.ZERO:

Here Is all of my code:

extends "res://ACTORS/"

#Basic Attacks
var attacks = ['weapon1', 'weapon2']
var all_skills = []
var current_skills = []

#Idle Animations
var idle_animations = { 'right': 'idle_r', 
'left': 'idle_l',
 'down' : 'idle_d',
 'up': 'idle_u'}
#Movement Animations
var move_animations = { 'right': 'run_r', 
'left': 'run_l',
 'down' : 'run_d',
 'up': 'run_u'}

#Attack 1 Animations
var wpn1_animations = {'right': 'atk1_r', 
'left': 'atk1_l',
 'down' : 'atk1_d',
 'up': 'atk1_u'}

#AI or Not
var is_active = true

# func weapon1():

#Input Movement
func input_movement():
	if Input.is_action_pressed('move_right'):
	elif Input.is_action_pressed('move_left'):
	if Input.is_action_pressed("move_down"):
	elif Input.is_action_pressed('move_up'):
	#Is Idle?
	if velocity == Vector2.ZERO:

#Input Actions (Process)
func input_actions():
	if Input.is_action_pressed("attack_1"):

# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.

func _physics_process(_delta):
	velocity = velocity.normalized() * speed
	velocity = move_and_slide(velocity)
	velocity = Vector2.ZERO

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):

#Returns player
func get_class(): return "Player"

Thank you in advance.

According to the posted screen shot, it seems to have successfully looked up an animation name (atk1_d). But, it’s saying that no such animation exists. Are you sure you have an animation by that name (and that it doesn’t have a character case difference or some other typo)?

jgodfrey | 2020-11-28 23:13

So I checked today, and the animations didn’t exist, but I do remember creating them and them being different. I’m going to try recreating them. Thank you!

EDIT: I have recreated the animations, but had to change when animations were played, but the animations do play now!

WinterStep | 2020-11-29 02:16