extends Node2D class_name DragonSprite @export var hat: AnimatedSprite2D @export var shirt: AnimatedSprite2D @export var decor: AnimatedSprite2D @export var color: AnimatedSprite2D @export var hat_outfits: DragonOutfit @export var shirt_outfits: DragonOutfit @export var decor_outfits: DragonOutfit @export var color_outfits: DragonOutfit func dress(properties: DragonProperties): _set_dress(hat, hat_outfits.get_texture(properties.hat)) _set_dress(shirt, shirt_outfits.get_texture(properties.shirt)) _set_dress(decor, decor_outfits.get_texture(properties.decor)) _set_dress(color, color_outfits.get_texture(properties.color)) play_walk() func _set_dress(part: AnimatedSprite2D, dress: SpriteFrames): if dress == null: part.visible = false else: part.visible = true part.set_sprite_frames(dress) func walk_left(): $Dragon.scale.x = 1 func walk_right(): $Dragon.scale.x = -1 func _play_animation(animation_name: String, part: AnimatedSprite2D) -> void: if !part.is_visible(): return part.play(animation_name) func play_idle() -> void: _play_animation("idle", hat) _play_animation("idle", shirt) _play_animation("idle", decor) _play_animation("idle", color) func play_fly() -> void: _play_animation("fly", hat) _play_animation("fly", shirt) _play_animation("fly", decor) _play_animation("fly", color) func play_walk() -> void: _play_animation("walk", hat) _play_animation("walk", shirt) _play_animation("walk", decor) _play_animation("walk", color)