extends AnimatedSprite

onready var body: AnimatedSprite = $"../Body"
onready var hair: AnimatedSprite = $"../Hair"
onready var walker = $"../Walker"

var changedOnce: bool = true
var budge = true

func _on_frame_changed():
	if budge:
		if frame == 2:
			hair.set_position(Vector2(0, 0))
			body.set_position(Vector2(0, 0))
		elif frame == 0:
			hair.set_position(Vector2(0, 1))
			body.set_position(Vector2(0, 1))
	else:
		hair.set_position(Vector2(0, 1))
		body.set_position(Vector2(0, 1))
	if frame == 0:
		walker.step()

func play(var anim: String = "", var backwards: bool = false):
	if !is_playing():
		frame = 0
	.play(anim, backwards)

func stop():
	frame = 2
	.stop()
