0 votes

I have two buttons, each with its own animation player but the same animations.

(The following images are not displayed so I try to describe)
right button plays animation on the left button
animation card_flip
node structure

The scene has the following structure (excerpt):

Button 1
- Animationplayer
- Sprite
-- 2nd sprite

Button 2
- Animationplayer
- Sprite
-- 2nd sprite

The animationplayer has a simple animation which replaces "Sprite" with "2nd sprite"

Both buttons reference the same script.

func _on_Card_pressed() -> void:

My intention is:
If I push the first button the animation "card_flip" is played on the first button, if I press the 2nd button the animation is played on the 2nd button.
But if I press the 2nd button the animation is played on the first button.

One solution would probably be to duplicate the animations and rename it eg. "cardflip2"
But I'm pretty sure there is an easier way.

Any suggestions appreciated
Thanks Boris

Godot version v3.5.1.stable.official [6fed1ffa3]
in Engine by (20 points)
edited by

1 Answer

0 votes

Think I found solution:
- create for 1 card, which contains the animation player its own scene
- set for the animation "local to scene" true
- add this scene to the main scene tree

by (20 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.