feat: animations working

This commit is contained in:
Gerard Gascón 2025-04-12 17:12:04 +02:00
parent 2a9e824a9e
commit 2445a71f0c
63 changed files with 3023 additions and 1408 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,379 @@
[gd_scene load_steps=7 format=3 uid="uid://bs45hvb2mpw4k"]
[gd_scene load_steps=57 format=3 uid="uid://bs45hvb2mpw4k"]
[ext_resource type="Texture2D" uid="uid://fdqnc2qrrvn1" path="res://assets/sprites/icon.svg" id="1_4i8li"]
[ext_resource type="Script" uid="uid://d1bq5f35wptxt" path="res://scenes/dragon_list/dragon_list_entry.gd" id="1_s7he7"]
[ext_resource type="FontFile" uid="uid://dn8qanm8tctb2" path="res://assets/fonts/Montserrat-Regular.ttf" id="2_s7he7"]
[ext_resource type="Resource" uid="uid://cnhwn6kfcbjl5" path="res://assets/outfits/hats.tres" id="2_y33em"]
[ext_resource type="Resource" uid="uid://etegcak2sphs" path="res://assets/outfits/shirts.tres" id="3_84ie0"]
[ext_resource type="Resource" uid="uid://ba5684xylts3f" path="res://assets/outfits/decor.tres" id="4_xvxt0"]
[ext_resource type="SpriteFrames" uid="uid://ccxyplt2t7t6y" path="res://assets/animations/hats/barretina.tres" id="2_xvxt0"]
[ext_resource type="Script" uid="uid://rw26nny160xh" path="res://src/dragon_outfit.gd" id="3_eop0l"]
[ext_resource type="Texture2D" uid="uid://c7nmelv0lx3i3" path="res://assets/sprites/decor/DP_acc_escut_Anim.png" id="4_xvxt0"]
[ext_resource type="Texture2D" uid="uid://drnel2cjwf5dr" path="res://assets/sprites/decor/DP_acc_espasa_Anim.png" id="5_eop0l"]
[ext_resource type="Texture2D" uid="uid://dbbcv076jh4ep" path="res://assets/sprites/decor/DP_acc_rosa_Anim.png" id="6_chh13"]
[sub_resource type="Resource" id="Resource_nlx3a"]
script = ExtResource("3_eop0l")
allow_null = true
outfits = Array[SpriteFrames]([ExtResource("2_xvxt0")])
metadata/_custom_type_script = "uid://rw26nny160xh"
[sub_resource type="Resource" id="Resource_1dq4x"]
script = ExtResource("3_eop0l")
allow_null = true
outfits = Array[SpriteFrames]([ExtResource("2_xvxt0")])
metadata/_custom_type_script = "uid://rw26nny160xh"
[sub_resource type="AtlasTexture" id="AtlasTexture_n1vju"]
atlas = ExtResource("4_xvxt0")
region = Rect2(0, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_m1nfd"]
atlas = ExtResource("4_xvxt0")
region = Rect2(108, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_3fnsk"]
atlas = ExtResource("4_xvxt0")
region = Rect2(216, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_njuvk"]
atlas = ExtResource("4_xvxt0")
region = Rect2(324, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_mq26c"]
atlas = ExtResource("4_xvxt0")
region = Rect2(0, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_p6fb4"]
atlas = ExtResource("4_xvxt0")
region = Rect2(108, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_fwa0p"]
atlas = ExtResource("4_xvxt0")
region = Rect2(216, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_26ptf"]
atlas = ExtResource("4_xvxt0")
region = Rect2(324, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_amy8y"]
atlas = ExtResource("4_xvxt0")
region = Rect2(432, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_knwp6"]
atlas = ExtResource("4_xvxt0")
region = Rect2(540, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_yfy00"]
atlas = ExtResource("4_xvxt0")
region = Rect2(0, 108, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_bnccx"]
atlas = ExtResource("4_xvxt0")
region = Rect2(108, 108, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_hc8ch"]
atlas = ExtResource("4_xvxt0")
region = Rect2(216, 108, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_0nuxw"]
atlas = ExtResource("4_xvxt0")
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("5_eop0l")
region = Rect2(0, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_1uixo"]
atlas = ExtResource("5_eop0l")
region = Rect2(108, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_xccp0"]
atlas = ExtResource("5_eop0l")
region = Rect2(216, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_nyede"]
atlas = ExtResource("5_eop0l")
region = Rect2(324, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_cxse4"]
atlas = ExtResource("5_eop0l")
region = Rect2(0, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_edjcl"]
atlas = ExtResource("5_eop0l")
region = Rect2(108, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_jhak8"]
atlas = ExtResource("5_eop0l")
region = Rect2(216, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_t2351"]
atlas = ExtResource("5_eop0l")
region = Rect2(324, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_uw07h"]
atlas = ExtResource("5_eop0l")
region = Rect2(432, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_xcrai"]
atlas = ExtResource("5_eop0l")
region = Rect2(540, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_tywya"]
atlas = ExtResource("5_eop0l")
region = Rect2(0, 108, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_7pu4u"]
atlas = ExtResource("5_eop0l")
region = Rect2(108, 108, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_i1w1o"]
atlas = ExtResource("5_eop0l")
region = Rect2(216, 108, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_xsi0i"]
atlas = ExtResource("5_eop0l")
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("6_chh13")
region = Rect2(0, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_uera2"]
atlas = ExtResource("6_chh13")
region = Rect2(108, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_0q8tn"]
atlas = ExtResource("6_chh13")
region = Rect2(216, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_f2bes"]
atlas = ExtResource("6_chh13")
region = Rect2(324, 216, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_albls"]
atlas = ExtResource("6_chh13")
region = Rect2(0, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_mlrdx"]
atlas = ExtResource("6_chh13")
region = Rect2(108, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_dipuj"]
atlas = ExtResource("6_chh13")
region = Rect2(216, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_d0xss"]
atlas = ExtResource("6_chh13")
region = Rect2(324, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_mpdbr"]
atlas = ExtResource("6_chh13")
region = Rect2(432, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_dy3ut"]
atlas = ExtResource("6_chh13")
region = Rect2(540, 0, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_gi66g"]
atlas = ExtResource("6_chh13")
region = Rect2(0, 108, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_am77p"]
atlas = ExtResource("6_chh13")
region = Rect2(108, 108, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_asxml"]
atlas = ExtResource("6_chh13")
region = Rect2(216, 108, 108, 108)
[sub_resource type="AtlasTexture" id="AtlasTexture_pral7"]
atlas = ExtResource("6_chh13")
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("3_eop0l")
allow_null = true
outfits = Array[SpriteFrames]([SubResource("SpriteFrames_gqmmt"), SubResource("SpriteFrames_yc10j"), SubResource("SpriteFrames_rhebu")])
metadata/_custom_type_script = "uid://rw26nny160xh"
[node name="DragonProperties" type="Control" node_paths=PackedStringArray("texture_rect", "name_label", "origin_label")]
custom_minimum_size = Vector2(0, 128)
@ -15,9 +383,9 @@ script = ExtResource("1_s7he7")
texture_rect = NodePath("TextureRect")
name_label = NodePath("Name")
origin_label = NodePath("Origin")
hat_outfits = ExtResource("2_y33em")
shirt_outfits = ExtResource("3_84ie0")
shoes_outfits = ExtResource("4_xvxt0")
hat_outfits = SubResource("Resource_nlx3a")
shirt_outfits = SubResource("Resource_1dq4x")
shoes_outfits = SubResource("Resource_if2jb")
[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 0

View file

@ -18,7 +18,7 @@ func dress(properties: DragonProperties):
_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_idle()
play_walk()
func _set_dress(part: AnimatedSprite2D, dress: SpriteFrames):
@ -30,19 +30,19 @@ func _set_dress(part: AnimatedSprite2D, dress: SpriteFrames):
func walk_left():
$Sprite.scale.x = 1
$DragonBody.scale.x = 1
$Dragon.scale.x = 1
func walk_right():
$Sprite.scale.x = -1
$DragonBody.scale.x = -1
$Dragon.scale.x = -1
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:

View file

@ -1,14 +1,11 @@
[gd_scene load_steps=11 format=3 uid="uid://baa8gpicw2yg0"]
[gd_scene load_steps=8 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://cnhwn6kfcbjl5" path="res://assets/outfits/hats.tres" id="2_mxc00"]
[ext_resource type="Resource" uid="uid://etegcak2sphs" path="res://assets/outfits/shirts.tres" id="3_umqeb"]
[ext_resource type="Resource" uid="uid://ba5684xylts3f" path="res://assets/outfits/decor.tres" id="4_7b2ll"]
[ext_resource type="Resource" uid="uid://bcs60f2k7h0jc" path="res://assets/outfits/dragons.tres" id="5_x2k4p"]
[ext_resource type="SpriteFrames" uid="uid://4cm7picl2gvs" path="res://assets/animations/dragons/green.tres" id="6_yf7bj"]
[ext_resource type="SpriteFrames" uid="uid://cwxqw54jvqryh" path="res://assets/animations/hats/barretina.tres" id="10_7b2ll"]
[ext_resource type="SpriteFrames" uid="uid://csm1127xw2qoh" path="res://assets/animations/shirts/traje.tres" id="11_x2k4p"]
[ext_resource type="SpriteFrames" uid="uid://cjoufnwxcvvf4" path="res://assets/animations/decor/rosa.tres" id="12_rhebu"]
[ext_resource type="Resource" uid="uid://x063x858re3f" path="res://assets/outfits/hats.tres" id="2_mxc00"]
[ext_resource type="Resource" uid="uid://bsydervvb1jpe" path="res://assets/outfits/shirts.tres" id="3_umqeb"]
[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"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_oaoux"]
size = Vector2(108, 88)
@ -33,16 +30,15 @@ shape = SubResource("RectangleShape2D_oaoux")
[node name="Dragon" type="AnimatedSprite2D" parent="."]
position = Vector2(54, 34)
sprite_frames = ExtResource("6_yf7bj")
animation = &"idle"
[node name="Hat" type="AnimatedSprite2D" parent="Dragon"]
sprite_frames = ExtResource("10_7b2ll")
animation = &""
[node name="Shirt" type="AnimatedSprite2D" parent="Dragon"]
sprite_frames = ExtResource("11_x2k4p")
animation = &""
[node name="Decor" type="AnimatedSprite2D" parent="Dragon"]
sprite_frames = ExtResource("12_rhebu")
animation = &"walk"
[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"]

View file

@ -114,8 +114,8 @@ func _load_game():
func _instantiate_dragon_ingame(window_position: Vector2, properties: DragonProperties) -> DragonEntity:
var dragon: DragonEntity = dragon_ingame.instantiate()
dragon.dress(properties)
add_child(dragon)
dragon.dress(properties)
dragon.properties = properties
dragon.position = window_position
dragon.on_pick.connect(_pick_dragon)

View file

@ -1,14 +1,16 @@
[gd_scene load_steps=16 format=3 uid="uid://ctytpqaed0yqx"]
[gd_scene load_steps=66 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="Resource" uid="uid://cnhwn6kfcbjl5" path="res://assets/outfits/hats.tres" id="4_85g3d"]
[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="Resource" uid="uid://etegcak2sphs" path="res://assets/outfits/shirts.tres" id="5_choun"]
[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="Resource" uid="uid://ba5684xylts3f" path="res://assets/outfits/decor.tres" id="6_ya4ey"]
[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"]
@ -16,15 +18,381 @@
[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 = ExtResource("4_85g3d")
shirt_outfits = ExtResource("5_choun")
shoes_outfits = ExtResource("6_ya4ey")
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

View file

@ -35,7 +35,7 @@ var current_state: State = State.WALKING_IDLE
func _ready() -> void:
draggable.on_drag.connect(_on_drag)
draggable.on_drop.connect(_on_drop)
current_state = State.FALLING
_change_state(State.FALLING)
func on_place_back() -> void:
@ -50,12 +50,6 @@ func _process(delta: float) -> void:
State.DRAGGING:
_thinking_path = false
_actual_position = position
State.WALKING_IDLE:
if not _thinking_path:
_think_path()
State.FLYING_IDLE:
if not _thinking_path:
_think_path()
State.WALKING:
_move_to_target(delta)
State.FALLING:
@ -66,12 +60,30 @@ func _process(delta: float) -> void:
properties.position = position
func _change_state(new_state):
match new_state:
State.DRAGGING:
dragon.play_idle()
State.WALKING_IDLE:
dragon.play_idle()
_think_path()
State.FLYING_IDLE:
_think_path()
State.WALKING:
dragon.play_walk()
State.FALLING:
dragon.play_idle()
State.FLYING:
dragon.play_fly()
current_state = new_state
func dress():
dragon.dress(properties)
func _think_path():
_thinking_path = true
await get_tree().create_timer(rng.randf_range(2, 7)).timeout
dragon_speed = rng.randf_range(dragon_speed_min, dragon_speed_max)
@ -86,7 +98,7 @@ func _think_path():
var decision: int = rng.randi_range(0, 99)
if decision < 30:
_fall_speed = 0
current_state = State.FALLING
_change_state(State.FALLING)
else:
_pick_random_screen_fly_position()
@ -98,7 +110,7 @@ func _fall(delta: float) -> void:
var ground_height: int = _ground_height()
if position.y >= ground_height:
current_state = State.WALKING_IDLE
_change_state(State.WALKING_IDLE)
position.y = ground_height
_actual_position.y = ground_height
@ -117,24 +129,24 @@ func _move_to_target(delta: float):
match current_state:
State.FLYING:
current_state = State.FLYING_IDLE
_change_state(State.FLYING_IDLE)
State.WALKING:
current_state = State.WALKING_IDLE
_change_state(State.WALKING_IDLE)
func _on_drag():
current_state = State.DRAGGING
_change_state(State.DRAGGING)
func _on_drop():
var ground_height: int = _ground_height()
if position.y >= ground_height:
current_state = State.WALKING_IDLE
_change_state(State.WALKING_IDLE)
position.y = ground_height
_actual_position.y = ground_height
else:
_fall_speed = 0
current_state = State.FALLING
_change_state(State.FALLING)
func _get_display_limits() -> Rect2i:
@ -151,7 +163,7 @@ func _ground_height() -> int:
func _pick_random_screen_fly_position() -> void:
current_state = State.FLYING
_change_state(State.FLYING)
_thinking_path = false
var limits: Rect2i = _get_display_limits()
@ -165,7 +177,7 @@ func _pick_random_screen_fly_position() -> void:
func _pick_random_screen_walk_position() -> void:
current_state = State.WALKING
_change_state(State.WALKING)
_thinking_path = false
var limits: Rect2i = _get_display_limits()

View file

@ -7,7 +7,7 @@
[node name="DragonPopup" type="Window" node_paths=PackedStringArray("dragon", "draggable")]
disable_3d = true
transparent_bg = true
size = Vector2i(76, 88)
size = Vector2i(108, 88)
unresizable = true
borderless = true
always_on_top = true