feat: choose outfit from library when creating a dragon

This commit is contained in:
Gerard Gascón 2025-04-08 23:02:17 +02:00
parent fd8609c0ab
commit f07b28d2dc
22 changed files with 370 additions and 17 deletions

View file

@ -2,5 +2,40 @@ extends Window
class_name DragonEditor
@onready var hat: TextureRect = $CanvasLayer/Dragon/Hat
@onready var shirt: TextureRect = $CanvasLayer/Dragon/Shirt
@onready var shoes: TextureRect = $CanvasLayer/Dragon/Shoes
@export var hat_outfits: DragonOutfit
@export var shirt_outfits: DragonOutfit
@export var shoes_outfits: DragonOutfit
signal on_create_dragon(hat: Texture2D, shirt: Texture2D, shoes: Texture2D)
func _ready() -> void:
hat.texture = null
shirt.texture = null
shoes.texture = null
func _on_close_requested() -> void:
queue_free()
func _on_change_hat_pressed() -> void:
hat.texture = hat_outfits.pick_next()
func _on_change_shirt_pressed() -> void:
shirt.texture = shirt_outfits.pick_next()
func _on_change_shoes_pressed() -> void:
shoes.texture = shoes_outfits.pick_next()
func _on_create_pressed() -> void:
on_create_dragon.emit(hat.texture, shirt.texture, shoes.texture)
queue_free()