full moonwalk

This commit is contained in:
Page Asgardius 2024-01-20 16:25:10 -07:00
parent 9dda46397e
commit 05d2c2e424
4 changed files with 91 additions and 11 deletions

View file

@ -23,14 +23,26 @@ func _physics_process(delta):
angle = 2
elif Global.ym < -0.3:
angle = 0
elif Global.xm > 0.3:
angle = 1
elif Global.xm < -0.3:
angle = 3
if velocity.y != 0 || velocity.x != 0:
if angle == 0:
anim.play("nwalk")
elif angle == 1:
anim.play("ewalk")
elif angle == 3:
anim.play("wwalk")
else:
anim.play("swalk")
else:
if angle == 0:
anim.play("nidle")
elif angle == 1:
anim.play("eidle")
elif angle == 3:
anim.play("widle")
else:
anim.play("sidle")
move_and_slide()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://cehe6sm8ly06u"]
[gd_scene load_steps=14 format=3 uid="uid://cehe6sm8ly06u"]
[ext_resource type="Script" path="res://sprites/common/midori/midori.gd" id="1_6vvcv"]
[ext_resource type="Texture2D" uid="uid://bc2vrf8qggvtp" path="res://sprites/common/midori/sprite.png" id="1_oqq2w"]
@ -38,7 +38,7 @@ tracks/0/keys = {
[sub_resource type="Animation" id="Animation_7lhgw"]
resource_name = "nwalk"
length = 0.2
length = 0.3
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
@ -47,10 +47,10 @@ tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [4, 5]
"values": [4, 3, 5]
}
[sub_resource type="Animation" id="Animation_w3ius"]
@ -70,7 +70,7 @@ tracks/0/keys = {
[sub_resource type="Animation" id="Animation_u56r5"]
resource_name = "swalk"
length = 0.2
length = 0.3
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
@ -79,19 +79,87 @@ tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.1, 0.2),
"transitions": PackedFloat32Array(1, 1),
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [1, 2]
"values": [1, 0, 2]
}
[sub_resource type="Animation" id="Animation_8my4d"]
resource_name = "eidle"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [6]
}
[sub_resource type="Animation" id="Animation_op07l"]
resource_name = "ewalk"
length = 0.3
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [7, 6, 8]
}
[sub_resource type="Animation" id="Animation_isodq"]
resource_name = "widle"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.2),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [9]
}
[sub_resource type="Animation" id="Animation_letwb"]
resource_name = "wwalk"
length = 0.3
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [10, 9, 11]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_mh65y"]
_data = {
"RESET": SubResource("Animation_i5rhc"),
"eidle": SubResource("Animation_8my4d"),
"ewalk": SubResource("Animation_op07l"),
"nidle": SubResource("Animation_cajcr"),
"nwalk": SubResource("Animation_7lhgw"),
"sidle": SubResource("Animation_w3ius"),
"swalk": SubResource("Animation_u56r5")
"swalk": SubResource("Animation_u56r5"),
"widle": SubResource("Animation_isodq"),
"wwalk": SubResource("Animation_letwb")
}
[node name="Midori" type="CharacterBody2D"]
@ -100,7 +168,7 @@ script = ExtResource("1_6vvcv")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_oqq2w")
hframes = 3
vframes = 2
vframes = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 94)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.