Movement animation

This commit is contained in:
2024-10-25 18:07:30 +02:00
parent 5dc5c305e3
commit ce82a8b5f7
5 changed files with 179 additions and 7 deletions

View File

@ -7,7 +7,7 @@ collision_mask = 2
script = ExtResource("1_dutdq")
[node name="Timer" type="Timer" parent="."]
wait_time = 0.254
wait_time = 0.6
one_shot = true
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://cxdkngh6fo5p7"]
[gd_scene load_steps=26 format=3 uid="uid://cxdkngh6fo5p7"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_btp1f"]
[ext_resource type="Texture2D" uid="uid://bebck3y4sy2c8" path="res://assets/sprites/knight.png" id="1_uiil0"]
@ -19,6 +19,74 @@ region = Rect2(64, 0, 32, 32)
atlas = ExtResource("1_uiil0")
region = Rect2(96, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_npshh"]
atlas = ExtResource("1_uiil0")
region = Rect2(64, 160, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_qgwdj"]
atlas = ExtResource("1_uiil0")
region = Rect2(0, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_wv0rq"]
atlas = ExtResource("1_uiil0")
region = Rect2(32, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_kqrkm"]
atlas = ExtResource("1_uiil0")
region = Rect2(64, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_2j53a"]
atlas = ExtResource("1_uiil0")
region = Rect2(96, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_58bgj"]
atlas = ExtResource("1_uiil0")
region = Rect2(128, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_npl2r"]
atlas = ExtResource("1_uiil0")
region = Rect2(160, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_iiw8n"]
atlas = ExtResource("1_uiil0")
region = Rect2(192, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_on6th"]
atlas = ExtResource("1_uiil0")
region = Rect2(224, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_844j4"]
atlas = ExtResource("1_uiil0")
region = Rect2(0, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_4nq6e"]
atlas = ExtResource("1_uiil0")
region = Rect2(32, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_k3ce1"]
atlas = ExtResource("1_uiil0")
region = Rect2(64, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_1bpnc"]
atlas = ExtResource("1_uiil0")
region = Rect2(96, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_l0cuk"]
atlas = ExtResource("1_uiil0")
region = Rect2(128, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_f78wu"]
atlas = ExtResource("1_uiil0")
region = Rect2(160, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_2tnwu"]
atlas = ExtResource("1_uiil0")
region = Rect2(192, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_1kmnq"]
atlas = ExtResource("1_uiil0")
region = Rect2(224, 96, 32, 32)
[sub_resource type="SpriteFrames" id="SpriteFrames_j6wpo"]
animations = [{
"frames": [{
@ -37,6 +105,67 @@ animations = [{
"loop": true,
"name": &"idle",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_npshh")
}],
"loop": true,
"name": &"jump",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_qgwdj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wv0rq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kqrkm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2j53a")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_58bgj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_npl2r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_iiw8n")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_on6th")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_844j4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4nq6e")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_k3ce1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1bpnc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l0cuk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_f78wu")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2tnwu")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1kmnq")
}],
"loop": true,
"name": &"run",
"speed": 10.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_lh46r"]
@ -49,9 +178,8 @@ script = ExtResource("1_btp1f")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(0, -12)
sprite_frames = SubResource("SpriteFrames_j6wpo")
animation = &"idle"
animation = &"jump"
autoplay = "idle"
frame_progress = 0.414056
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -6)