How to switch frames in a animatedsprite3d with a input in the input map godot 4

Godot Version

godot 4

Question

pls help

Something like this should work:

func _unhandled_input(event: InputEvent) -> void:
	if event.is_action_pressed("ui_left"):
		animated_sprite.frame -= 1
	elif event.is_action_pressed("ui_right"):
		animated_sprite.frame += 1

You can specify your actions in the InputMap to be used instead of the built-in ones “ui_left” and “ui_right”.

1 Like

thank you so much!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.