I suggest you watch this tutorial, which covers basic scripting stuff including handling input:
Then you just need an AnimationPlayer node with your animation. To play the animation, just call the play()
function on the animationplayer node, with something like: get_node("AnimationPlayer)".play("animation_name_here")