i hav a sprite image. How can i get the animation done with animationplayer only if i clicked on the sprite image?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Bibin
:warning: Old Version Published before Godot 3 was released.
:bust_in_silhouette: Reply From: vinod

You need to detect the click on the object and play the animation.
For that you need to add an Area2d.
Add a collider and your sprite as children of the area2d.

Then you can listen to the mouse click signal in the area2d and animate the sprite accordingly.