Hi Karol,
I am by no means an expert here. But I am curious why you are using the hide() function for your animations. I don't believe that is necessary.
I'll start by recommending Heartbeasts tutorial here it's fantastic and should give you a good starting point.
As for your script. It looks to be over complicated. But I guess it depends on what you are after. This is a snippet from Ben's tutorial:
const SPEED = 200
var motion = Vector2()
if Input.is_action_pressed("ui_right"):
motion.x = SPEED
$Sprite.flip_h = false
$Sprite.play("run")
elif Input.is_action_pressed("ui_left"):
motion.x = -SPEED
$Sprite.flip_h = true
$Sprite.play("run")
else:
motion.x = 0
I'm not entirely sure how you would implement this into your code...but maybe it will help? ¯_(ツ)_/¯