My Animations Aren't Playing

4.4.1

I made an attacking animation for my game I started yesterday but nothing happens when I click space.

My code:
if Input.is_action_just_released(“ui_accept”):
animated_sprite.play(“attack”)

What is wrong?

You should post the entire code and format it using the </> button.

Hmm. There is not enough code here to tell.

if Input.is_action_just_released(“ui_accept”):
     animated_sprite.play(“attack”)

There appears to be nothing wrong with the actual code you have pasted. But there could still be many problems.

Is your animated_sprite variable set correctly. Something like:

@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D

Is your animation actually called “attack”?

Where are you collecting input from? In _input there is no “just_released”.

func _input(event: InputEvent) -> void:
	if event.is_action_released("ui_accept"):
		animated_sprite_2d.play("attack")

Although this would work:

func _process(_delta: float) -> void:
	if Input.is_action_just_released("ui_accept"):
		animated_sprite_2d.play("attack")

When you say:

It is hard to tell without any more info. Is the node visible? Have you created the sprite_frames? What do you see exactly? Do you get any error messages?

Glad to help, need more input from you.