feat: animations working
This commit is contained in:
parent
2a9e824a9e
commit
2445a71f0c
63 changed files with 3023 additions and 1408 deletions
|
@ -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:
|
||||
|
|
|
@ -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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue