Godot Version
Godot 4.4.1v
Question
I want to use the walking animation for the main character, which I created using AnimatedSprite2D, in other scenes as well. How do I do that?
^^this is animation
^^ I want to use that in this scene
If i understand correctly you want to make your character (animation) be used in your doors scene right?
If that’s the case then you must add the player node to your doors scene (or have them in same node so they’re visible), then move player to the position of the doors you want to use (calculate it based off sprite’s size and global_position or position depending on method you’ll use) and then in your code you need to reference animated_sprite and do:
animation_sprite.play(&"default")
so it will start changing frames
If i’m wrong then you have to explain what you really want to do because there’s too few details to tell for sure
What i want is player character moves by direction key, playing the animation.
In game, the player must go three room in order.
ps. i use translator tool. so my comment is distorted.
then you must just use animation_sprite.play(&YOUR_ANIMATION_NAME) when your player is moving, you can do animation_sprite.stop() to stop that animation when player is not moving
if you want to detect movement, it depends how you want it to work, if you use WSAD use _input function and if you want it to move other way then it depends entirely on your code
it works! thank you!!