If you work with normal sprites, you can attach a AnimationPlayer node to it, in which you create a new animation and set its loop to false. Here is some more info on animating sprites. Give the animation a name eg “move”.
When your animation is set up, add some code to the object, something like this should work:
func _input(event):
if event is InputEventMouseButton:
$AnimationPlayer.play("move")
The same should work for 3D, correct? (Forgot to clarify I’m working with 3D.)
What about using the same code above but getting a animation from another scene?
Also, from using another scene, how and what should I be doing in order to bring that into the script?
I’ve tried doing get_tree but wasn’t sure how to go about the process.
I visual script, you drag the animationplayer node in, then you get a list, there’s a method called ’ Play (string) ', you expand the ’ Default arguments ', and put the name, in the box, then it plays, IF button pressed_on_object = TRUE . . .
You can set it up in visual script very fast, I think it’s similar lines of code, to the box ones, maybe a bit different . . .