From 44a36a4e673b7f170a2421f8d392346883121bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Gasc=C3=B3n?= <52170489+GerardGascon@users.noreply.github.com> Date: Sat, 12 Apr 2025 17:23:44 +0200 Subject: [PATCH] fix: corrections in dragon instantiation --- scenes/dragon_editor/dragon_editor.tscn | 17 +- scenes/dragons/dragon_sprite.gd | 2 - scenes/dragons/dragon_sprite.tscn | 13 +- scenes/main.gd | 4 - scenes/main.tscn | 376 +----------------------- 5 files changed, 12 insertions(+), 400 deletions(-) diff --git a/scenes/dragon_editor/dragon_editor.tscn b/scenes/dragon_editor/dragon_editor.tscn index 6394f94..31fa960 100644 --- a/scenes/dragon_editor/dragon_editor.tscn +++ b/scenes/dragon_editor/dragon_editor.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=169 format=3 uid="uid://fut42ruut302"] +[gd_scene load_steps=165 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="SpriteFrames" uid="uid://ccxyplt2t7t6y" path="res://assets/animations/hats/barretina.tres" id="2_aystc"] @@ -1088,17 +1088,6 @@ allow_null = false outfits = Array[SpriteFrames]([SubResource("SpriteFrames_0hqgm"), SubResource("SpriteFrames_o77k0"), SubResource("SpriteFrames_7b2ll"), SubResource("SpriteFrames_4orem"), SubResource("SpriteFrames_xqwu6"), SubResource("SpriteFrames_y4fkp")]) metadata/_custom_type_script = "uid://rw26nny160xh" -[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_f0h1k"] - -[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_ofxsr"] -load_path = "res://.godot/imported/DragonPet_barret_barretina.png-c34714d149520b48d66d5ee32f5868c1.ctex" - -[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_mc14k"] -load_path = "res://.godot/imported/DragonPet_roba_armadura.png-3cad0d14b8ca1ac4914a907d8acf7ec5.ctex" - -[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_jtpn4"] -load_path = "res://.godot/imported/DragonPet_acc_escut.png-ab5c138b3d2900950a73fcd404b97a42.ctex" - [sub_resource type="AtlasTexture" id="AtlasTexture_ofxsr"] atlas = ExtResource("7_qppok") region = Rect2(0, 40, 38, 40) @@ -1150,7 +1139,6 @@ offset_left = 76.0 offset_top = 120.0 offset_right = 152.0 offset_bottom = 208.0 -texture = SubResource("CompressedTexture2D_f0h1k") [node name="Hat" type="TextureRect" parent="CanvasLayer/Dragon"] layout_mode = 1 @@ -1165,7 +1153,6 @@ offset_right = 38.0 offset_bottom = 44.0 grow_horizontal = 2 grow_vertical = 2 -texture = SubResource("CompressedTexture2D_ofxsr") [node name="Shirt" type="TextureRect" parent="CanvasLayer/Dragon"] layout_mode = 1 @@ -1180,7 +1167,6 @@ offset_right = 38.0 offset_bottom = 44.0 grow_horizontal = 2 grow_vertical = 2 -texture = SubResource("CompressedTexture2D_mc14k") [node name="Shoes" type="TextureRect" parent="CanvasLayer/Dragon"] layout_mode = 1 @@ -1195,7 +1181,6 @@ offset_right = 38.0 offset_bottom = 44.0 grow_horizontal = 2 grow_vertical = 2 -texture = SubResource("CompressedTexture2D_jtpn4") [node name="Dragger" type="Control" parent="CanvasLayer"] layout_mode = 3 diff --git a/scenes/dragons/dragon_sprite.gd b/scenes/dragons/dragon_sprite.gd index da7f82c..2ee84c8 100644 --- a/scenes/dragons/dragon_sprite.gd +++ b/scenes/dragons/dragon_sprite.gd @@ -40,9 +40,7 @@ func walk_right(): func _play_animation(animation_name: String, part: AnimatedSprite2D) -> void: if !part.is_visible(): return - print(part) part.play(animation_name) - print(part.is_playing()) func play_idle() -> void: diff --git a/scenes/dragons/dragon_sprite.tscn b/scenes/dragons/dragon_sprite.tscn index 15fc737..c5718ec 100644 --- a/scenes/dragons/dragon_sprite.tscn +++ b/scenes/dragons/dragon_sprite.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://baa8gpicw2yg0"] +[gd_scene load_steps=11 format=3 uid="uid://baa8gpicw2yg0"] [ext_resource type="Script" uid="uid://bjiap06gs02j" path="res://scenes/dragons/dragon_sprite.gd" id="1_oaoux"] [ext_resource type="Resource" uid="uid://x063x858re3f" path="res://assets/outfits/hats.tres" id="2_mxc00"] @@ -6,6 +6,9 @@ [ext_resource type="Resource" uid="uid://dkm7d10c1lp2n" path="res://assets/outfits/decor.tres" id="4_7b2ll"] [ext_resource type="Resource" uid="uid://c03ejnvavmcj5" path="res://assets/outfits/dragons.tres" id="5_x2k4p"] [ext_resource type="SpriteFrames" uid="uid://duxxw4mfxql3c" path="res://assets/animations/dragons/verd.tres" id="6_yf7bj"] +[ext_resource type="SpriteFrames" uid="uid://ccxyplt2t7t6y" path="res://assets/animations/hats/barretina.tres" id="10_7b2ll"] +[ext_resource type="SpriteFrames" uid="uid://dsxhfu2ekw7j" path="res://assets/animations/shirts/traje.tres" id="11_x2k4p"] +[ext_resource type="SpriteFrames" uid="uid://c5rqqy7b5ihi5" path="res://assets/animations/decor/rosa.tres" id="12_rhebu"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_oaoux"] size = Vector2(108, 88) @@ -33,12 +36,16 @@ sprite_frames = ExtResource("6_yf7bj") animation = &"idle" [node name="Hat" type="AnimatedSprite2D" parent="Dragon"] -animation = &"" +sprite_frames = ExtResource("10_7b2ll") +animation = &"idle" [node name="Shirt" type="AnimatedSprite2D" parent="Dragon"] -animation = &"" +sprite_frames = ExtResource("11_x2k4p") +animation = &"idle" [node name="Decor" type="AnimatedSprite2D" parent="Dragon"] +sprite_frames = ExtResource("12_rhebu") +animation = &"idle" [connection signal="mouse_entered" from="Area2D" to="." method="_on_area_2d_mouse_entered"] [connection signal="mouse_exited" from="Area2D" to="." method="_on_area_2d_mouse_exited"] diff --git a/scenes/main.gd b/scenes/main.gd index 795ac4e..fbef46a 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -10,10 +10,6 @@ class_name GameManager var _filled_spots: Dictionary[Node2D, int] -@export var hat_outfits: DragonOutfit -@export var shirt_outfits: DragonOutfit -@export var shoes_outfits: DragonOutfit - var _instantiator: DragonInstantiator var _save_load: SaveLoad var _library: DragonLibrary diff --git a/scenes/main.tscn b/scenes/main.tscn index 80f3a52..04bd148 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,16 +1,11 @@ -[gd_scene load_steps=66 format=3 uid="uid://ctytpqaed0yqx"] +[gd_scene load_steps=13 format=3 uid="uid://ctytpqaed0yqx"] [ext_resource type="Script" uid="uid://3kyt3shje5r1" path="res://scenes/main.gd" id="1_sugp2"] [ext_resource type="PackedScene" uid="uid://c7nfcgjxqeg7l" path="res://scenes/window/dragon_popup.tscn" id="2_jyhfs"] [ext_resource type="PackedScene" uid="uid://bj5ptaniasaaj" path="res://scenes/clock/clock.tscn" id="4_a8y0u"] [ext_resource type="PackedScene" uid="uid://miutbdsgccd1" path="res://scenes/dragons/dragon.tscn" id="4_jyhfs"] [ext_resource type="Script" uid="uid://cj4l3a6a8ro0r" path="res://scenes/create_button.gd" id="4_tbgi4"] -[ext_resource type="SpriteFrames" uid="uid://ccxyplt2t7t6y" path="res://assets/animations/hats/barretina.tres" id="5_muem4"] [ext_resource type="PackedScene" uid="uid://fut42ruut302" path="res://scenes/dragon_editor/dragon_editor.tscn" id="5_tefeu"] -[ext_resource type="Script" uid="uid://rw26nny160xh" path="res://src/dragon_outfit.gd" id="6_dp3eg"] -[ext_resource type="Texture2D" uid="uid://c7nmelv0lx3i3" path="res://assets/sprites/decor/DP_acc_escut_Anim.png" id="7_muem4"] -[ext_resource type="Texture2D" uid="uid://drnel2cjwf5dr" path="res://assets/sprites/decor/DP_acc_espasa_Anim.png" id="8_dp3eg"] -[ext_resource type="Texture2D" uid="uid://dbbcv076jh4ep" path="res://assets/sprites/decor/DP_acc_rosa_Anim.png" id="9_0ld40"] [ext_resource type="Script" uid="uid://oc6mw86npbii" path="res://scenes/list_button.gd" id="9_choun"] [ext_resource type="PackedScene" uid="uid://tubxrqxjic6r" path="res://scenes/dragon_list/dragon_list.tscn" id="10_ya4ey"] [ext_resource type="Texture2D" uid="uid://bc2lykc3gwykh" path="res://assets/sprites/environment/castle/DP_castle_back.png" id="15_muem4"] @@ -18,381 +13,12 @@ [ext_resource type="Texture2D" uid="uid://b1w6y1qvetsaw" path="res://assets/sprites/environment/castle/DP_castle_front.png" id="17_0ld40"] [ext_resource type="Script" uid="uid://bg58e3dobon4j" path="res://scenes/dragon_sharing.gd" id="17_muem4"] -[sub_resource type="Resource" id="Resource_nlx3a"] -script = ExtResource("6_dp3eg") -allow_null = true -outfits = Array[SpriteFrames]([ExtResource("5_muem4")]) -metadata/_custom_type_script = "uid://rw26nny160xh" - -[sub_resource type="Resource" id="Resource_1dq4x"] -script = ExtResource("6_dp3eg") -allow_null = true -outfits = Array[SpriteFrames]([ExtResource("5_muem4")]) -metadata/_custom_type_script = "uid://rw26nny160xh" - -[sub_resource type="AtlasTexture" id="AtlasTexture_n1vju"] -atlas = ExtResource("7_muem4") -region = Rect2(0, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_m1nfd"] -atlas = ExtResource("7_muem4") -region = Rect2(108, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_3fnsk"] -atlas = ExtResource("7_muem4") -region = Rect2(216, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_njuvk"] -atlas = ExtResource("7_muem4") -region = Rect2(324, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_mq26c"] -atlas = ExtResource("7_muem4") -region = Rect2(0, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_p6fb4"] -atlas = ExtResource("7_muem4") -region = Rect2(108, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_fwa0p"] -atlas = ExtResource("7_muem4") -region = Rect2(216, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_26ptf"] -atlas = ExtResource("7_muem4") -region = Rect2(324, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_amy8y"] -atlas = ExtResource("7_muem4") -region = Rect2(432, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_knwp6"] -atlas = ExtResource("7_muem4") -region = Rect2(540, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_yfy00"] -atlas = ExtResource("7_muem4") -region = Rect2(0, 108, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_bnccx"] -atlas = ExtResource("7_muem4") -region = Rect2(108, 108, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_hc8ch"] -atlas = ExtResource("7_muem4") -region = Rect2(216, 108, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_0nuxw"] -atlas = ExtResource("7_muem4") -region = Rect2(324, 108, 108, 108) - -[sub_resource type="SpriteFrames" id="SpriteFrames_gqmmt"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_n1vju") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_m1nfd") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_3fnsk") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_njuvk") -}], -"loop": true, -"name": &"fly", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_mq26c") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_p6fb4") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_fwa0p") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_26ptf") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_amy8y") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_knwp6") -}], -"loop": true, -"name": &"idle", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_yfy00") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_bnccx") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_hc8ch") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_0nuxw") -}], -"loop": true, -"name": &"walk", -"speed": 5.0 -}] - -[sub_resource type="AtlasTexture" id="AtlasTexture_qwppa"] -atlas = ExtResource("8_dp3eg") -region = Rect2(0, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_1uixo"] -atlas = ExtResource("8_dp3eg") -region = Rect2(108, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_xccp0"] -atlas = ExtResource("8_dp3eg") -region = Rect2(216, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_nyede"] -atlas = ExtResource("8_dp3eg") -region = Rect2(324, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_cxse4"] -atlas = ExtResource("8_dp3eg") -region = Rect2(0, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_edjcl"] -atlas = ExtResource("8_dp3eg") -region = Rect2(108, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_jhak8"] -atlas = ExtResource("8_dp3eg") -region = Rect2(216, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_t2351"] -atlas = ExtResource("8_dp3eg") -region = Rect2(324, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_uw07h"] -atlas = ExtResource("8_dp3eg") -region = Rect2(432, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_xcrai"] -atlas = ExtResource("8_dp3eg") -region = Rect2(540, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_tywya"] -atlas = ExtResource("8_dp3eg") -region = Rect2(0, 108, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_7pu4u"] -atlas = ExtResource("8_dp3eg") -region = Rect2(108, 108, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_i1w1o"] -atlas = ExtResource("8_dp3eg") -region = Rect2(216, 108, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_xsi0i"] -atlas = ExtResource("8_dp3eg") -region = Rect2(324, 108, 108, 108) - -[sub_resource type="SpriteFrames" id="SpriteFrames_yc10j"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_qwppa") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_1uixo") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_xccp0") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_nyede") -}], -"loop": true, -"name": &"fly", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_cxse4") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_edjcl") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_jhak8") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_t2351") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_uw07h") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_xcrai") -}], -"loop": true, -"name": &"idle", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_tywya") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_7pu4u") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_i1w1o") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_xsi0i") -}], -"loop": true, -"name": &"walk", -"speed": 5.0 -}] - -[sub_resource type="AtlasTexture" id="AtlasTexture_ifv4k"] -atlas = ExtResource("9_0ld40") -region = Rect2(0, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_uera2"] -atlas = ExtResource("9_0ld40") -region = Rect2(108, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_0q8tn"] -atlas = ExtResource("9_0ld40") -region = Rect2(216, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_f2bes"] -atlas = ExtResource("9_0ld40") -region = Rect2(324, 216, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_albls"] -atlas = ExtResource("9_0ld40") -region = Rect2(0, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_mlrdx"] -atlas = ExtResource("9_0ld40") -region = Rect2(108, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_dipuj"] -atlas = ExtResource("9_0ld40") -region = Rect2(216, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_d0xss"] -atlas = ExtResource("9_0ld40") -region = Rect2(324, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_mpdbr"] -atlas = ExtResource("9_0ld40") -region = Rect2(432, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_dy3ut"] -atlas = ExtResource("9_0ld40") -region = Rect2(540, 0, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_gi66g"] -atlas = ExtResource("9_0ld40") -region = Rect2(0, 108, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_am77p"] -atlas = ExtResource("9_0ld40") -region = Rect2(108, 108, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_asxml"] -atlas = ExtResource("9_0ld40") -region = Rect2(216, 108, 108, 108) - -[sub_resource type="AtlasTexture" id="AtlasTexture_pral7"] -atlas = ExtResource("9_0ld40") -region = Rect2(324, 108, 108, 108) - -[sub_resource type="SpriteFrames" id="SpriteFrames_rhebu"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_ifv4k") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_uera2") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_0q8tn") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_f2bes") -}], -"loop": true, -"name": &"fly", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_albls") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_mlrdx") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_dipuj") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_d0xss") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_mpdbr") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_dy3ut") -}], -"loop": true, -"name": &"idle", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_gi66g") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_am77p") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_asxml") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_pral7") -}], -"loop": true, -"name": &"walk", -"speed": 5.0 -}] - -[sub_resource type="Resource" id="Resource_if2jb"] -script = ExtResource("6_dp3eg") -allow_null = true -outfits = Array[SpriteFrames]([SubResource("SpriteFrames_gqmmt"), SubResource("SpriteFrames_yc10j"), SubResource("SpriteFrames_rhebu")]) -metadata/_custom_type_script = "uid://rw26nny160xh" - [node name="Base" type="Node2D" node_paths=PackedStringArray("dragon_spots")] script = ExtResource("1_sugp2") dragon_template = ExtResource("2_jyhfs") dragon_ingame = ExtResource("4_jyhfs") dragon_spots = [NodePath("DragonSpot1"), NodePath("DragonSpot2"), NodePath("DragonSpot3")] clock = ExtResource("4_a8y0u") -hat_outfits = SubResource("Resource_nlx3a") -shirt_outfits = SubResource("Resource_1dq4x") -shoes_outfits = SubResource("Resource_if2jb") min_dragon_instantiation_time = 2.0 max_dragon_instantiation_time = 10.0