class_name SpriteFlipH
extends Node3D

@onready var eyes: AnimatedSprite3D = $"../Eyes"
@onready var mouth: AnimatedSprite3D = $"../Mouth"
@onready var shine: AnimatedSprite3D = $"../Shine"
@onready var wind: AnimatedSprite3D = $"../Wind"

@onready var sprites_to_flip = [eyes, mouth, shine, wind]

func _process(_delta: float) -> void:
	# Get input direction
	var direction = Input.get_axis("move_left", "move_right")
	
	# Only flip if there's horizontal input
	if direction != 0:
		# Flip all sprites in the array
		for sprite in sprites_to_flip:
			if sprite is AnimatedSprite3D:
				sprite.flip_h = (direction < 0)
		if direction > 0:
			wind.offset = Vector2(500, 0)
		elif direction < 0:
			wind.offset = Vector2(-500, 0)
