Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | boris0dev |
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)
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:
$AnimationPlayer.play("card_flip")
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. “card_flip_2”
But I’m pretty sure there is an easier way.
Any suggestions appreciated
Thanks Boris