feat: choose outfit from library when creating a dragon
This commit is contained in:
parent
fd8609c0ab
commit
f07b28d2dc
22 changed files with 370 additions and 17 deletions
|
@ -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()
|
||||
|
|
|
@ -1,12 +1,123 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://fut42ruut302"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://fut42ruut302"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bfuos2kgfgber" path="res://scenes/dragon_editor/dragon_editor.gd" id="1_8vkll"]
|
||||
[ext_resource type="Texture2D" uid="uid://fdqnc2qrrvn1" path="res://assets/sprites/icon.svg" id="2_un5ur"]
|
||||
[ext_resource type="Resource" uid="uid://cnhwn6kfcbjl5" path="res://assets/outfits/hats.tres" id="2_vvtct"]
|
||||
[ext_resource type="Texture2D" uid="uid://s1gx0l4qciqn" path="res://assets/sprites/hat.png" id="3_4q6gv"]
|
||||
[ext_resource type="Resource" uid="uid://etegcak2sphs" path="res://assets/outfits/shirts.tres" id="3_xhgxf"]
|
||||
[ext_resource type="Resource" uid="uid://ba5684xylts3f" path="res://assets/outfits/shoes.tres" id="4_1ivi1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dc2uk6tqtwl4n" path="res://assets/sprites/shirt.png" id="4_6sr44"]
|
||||
[ext_resource type="Texture2D" uid="uid://8srlwinjr3tt" path="res://assets/sprites/shoes.png" id="5_wby0j"]
|
||||
|
||||
[node name="DragonEditor" type="Window"]
|
||||
title = "Dragon Editor"
|
||||
position = Vector2i(0, 36)
|
||||
size = Vector2i(300, 500)
|
||||
min_size = Vector2i(300, 500)
|
||||
max_size = Vector2i(1000, 1000)
|
||||
script = ExtResource("1_8vkll")
|
||||
hat_outfits = ExtResource("2_vvtct")
|
||||
shirt_outfits = ExtResource("3_xhgxf")
|
||||
shoes_outfits = ExtResource("4_1ivi1")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer"]
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -89.0
|
||||
offset_bottom = 101.0
|
||||
grow_horizontal = 0
|
||||
|
||||
[node name="change_hat" type="Button" parent="CanvasLayer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "barret"
|
||||
|
||||
[node name="change_shirt" type="Button" parent="CanvasLayer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "samarreta"
|
||||
|
||||
[node name="change_shoes" type="Button" parent="CanvasLayer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "sabata"
|
||||
|
||||
[node name="create" type="Button" parent="CanvasLayer"]
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -42.0
|
||||
offset_top = -31.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
text = "crea"
|
||||
|
||||
[node name="Dragon" type="TextureRect" parent="CanvasLayer"]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -64.0
|
||||
offset_top = -64.0
|
||||
offset_right = 64.0
|
||||
offset_bottom = 64.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_un5ur")
|
||||
|
||||
[node name="Hat" type="TextureRect" parent="CanvasLayer/Dragon"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -90.0
|
||||
offset_top = -109.0
|
||||
offset_right = 93.0
|
||||
offset_bottom = 74.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("3_4q6gv")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Shirt" type="TextureRect" parent="CanvasLayer/Dragon"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -113.0
|
||||
offset_top = -59.0
|
||||
offset_right = 124.0
|
||||
offset_bottom = 79.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("4_6sr44")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Shoes" type="TextureRect" parent="CanvasLayer/Dragon"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -96.0
|
||||
offset_top = -119.0
|
||||
offset_right = 113.0
|
||||
offset_bottom = 90.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("5_wby0j")
|
||||
expand_mode = 1
|
||||
|
||||
[connection signal="close_requested" from="." to="." method="_on_close_requested"]
|
||||
[connection signal="pressed" from="CanvasLayer/VBoxContainer/change_hat" to="." method="_on_change_hat_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/VBoxContainer/change_shirt" to="." method="_on_change_shirt_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/VBoxContainer/change_shoes" to="." method="_on_change_shoes_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/create" to="." method="_on_create_pressed"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue