Walking in Animation Tree
This commit is contained in:
parent
58ee72f955
commit
b844984aed
8 changed files with 149 additions and 79 deletions
|
@ -8,7 +8,7 @@
|
|||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_dixrq"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bjsqx"]
|
||||
size = Vector2(64.4614, 47.0722)
|
||||
size = Vector2(43.3023, 13.4486)
|
||||
|
||||
[node name="Gym" type="Node2D"]
|
||||
y_sort_enabled = true
|
||||
|
@ -18,18 +18,18 @@ environment = SubResource("Environment_iaiy2")
|
|||
camera_attributes = SubResource("CameraAttributesPractical_dixrq")
|
||||
|
||||
[node name="player" parent="." instance=ExtResource("1_mkpg2")]
|
||||
position = Vector2(490, 44)
|
||||
position = Vector2(966, 130)
|
||||
floor_constant_speed = true
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="TreeSwamp01Sprt" type="Sprite2D" parent="StaticBody2D"]
|
||||
z_as_relative = false
|
||||
position = Vector2(0, -993)
|
||||
position = Vector2(0, -895)
|
||||
scale = Vector2(4.06445, 4.06445)
|
||||
texture = ExtResource("2_hscig")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||
position = Vector2(-3.8147e-06, -133)
|
||||
position = Vector2(21, -127.669)
|
||||
scale = Vector2(4.06445, 4.06445)
|
||||
shape = SubResource("RectangleShape2D_bjsqx")
|
||||
|
|
|
@ -23,5 +23,10 @@ func _physics_process(delta):
|
|||
else:
|
||||
velocity.y = move_toward(velocity.y, 0, SPEED)
|
||||
#endregion
|
||||
|
||||
var WalkLeft = directionX < 0
|
||||
$AnimationTree.set("parameters/Locomotion/conditions/Idle",(velocity.x == 0 and velocity.y == 0))
|
||||
$AnimationTree.set("parameters/Locomotion/conditions/WalkLeft",velocity.x != 0)
|
||||
|
||||
|
||||
move_and_slide()
|
||||
|
|
197
player.tscn
197
player.tscn
|
@ -1,13 +1,14 @@
|
|||
[gd_scene load_steps=22 format=3 uid="uid://0m1hk2nu4bps"]
|
||||
[gd_scene load_steps=19 format=3 uid="uid://0m1hk2nu4bps"]
|
||||
|
||||
[ext_resource type="Script" path="res://player.gd" id="1_0pgv8"]
|
||||
[ext_resource type="Texture2D" uid="uid://5pmqr3y62guu" path="res://player/currentCloth.tres" id="2_45h8h"]
|
||||
[ext_resource type="Animation" uid="uid://b85dikp6ps8i2" path="res://player/animations/idle.res" id="2_ymiw5"]
|
||||
[ext_resource type="Animation" uid="uid://2woypk4u40b5" path="res://player/animations/WalkLeft.res" id="3_2eohq"]
|
||||
[ext_resource type="Texture2D" uid="uid://5qixrbrclydr" path="res://player/currentHat.tres" id="3_qyf3b"]
|
||||
[ext_resource type="Texture2D" uid="uid://sod0ms1cfkjf" path="res://player/playerSkin_ref.png" id="4_ytgpb"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_kapu3"]
|
||||
size = Vector2(192, 256)
|
||||
size = Vector2(192, 148)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_oktsg"]
|
||||
length = 0.001
|
||||
|
@ -166,67 +167,139 @@ tracks/13/keys = {
|
|||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/14/type = "bezier"
|
||||
tracks/14/imported = false
|
||||
tracks/14/enabled = true
|
||||
tracks/14/path = NodePath("Skeleton2D/root/Hips:position:x")
|
||||
tracks/14/interp = 1
|
||||
tracks/14/loop_wrap = true
|
||||
tracks/14/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(-18, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/15/type = "bezier"
|
||||
tracks/15/imported = false
|
||||
tracks/15/enabled = true
|
||||
tracks/15/path = NodePath("Skeleton2D/root/Hips:position:y")
|
||||
tracks/15/interp = 1
|
||||
tracks/15/loop_wrap = true
|
||||
tracks/15/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(-93, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/16/type = "bezier"
|
||||
tracks/16/imported = false
|
||||
tracks/16/enabled = true
|
||||
tracks/16/path = NodePath("Skeleton2D/root/Hips/LegLeft:position:x")
|
||||
tracks/16/interp = 1
|
||||
tracks/16/loop_wrap = true
|
||||
tracks/16/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(77, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/17/type = "bezier"
|
||||
tracks/17/imported = false
|
||||
tracks/17/enabled = true
|
||||
tracks/17/path = NodePath("Skeleton2D/root/Hips/LegLeft:position:y")
|
||||
tracks/17/interp = 1
|
||||
tracks/17/loop_wrap = true
|
||||
tracks/17/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(52, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/18/type = "bezier"
|
||||
tracks/18/imported = false
|
||||
tracks/18/enabled = true
|
||||
tracks/18/path = NodePath("Skeleton2D/root/Hips/LegLeft:rotation")
|
||||
tracks/18/interp = 1
|
||||
tracks/18/loop_wrap = true
|
||||
tracks/18/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/19/type = "bezier"
|
||||
tracks/19/imported = false
|
||||
tracks/19/enabled = true
|
||||
tracks/19/path = NodePath("Skeleton2D/root/Hips/LegRight:rotation")
|
||||
tracks/19/interp = 1
|
||||
tracks/19/loop_wrap = true
|
||||
tracks/19/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/20/type = "bezier"
|
||||
tracks/20/imported = false
|
||||
tracks/20/enabled = true
|
||||
tracks/20/path = NodePath("Skeleton2D/root/Hips/LegRight:position:x")
|
||||
tracks/20/interp = 1
|
||||
tracks/20/loop_wrap = true
|
||||
tracks/20/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(-36, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/21/type = "bezier"
|
||||
tracks/21/imported = false
|
||||
tracks/21/enabled = true
|
||||
tracks/21/path = NodePath("Skeleton2D/root/Hips/LegRight:position:y")
|
||||
tracks/21/interp = 1
|
||||
tracks/21/loop_wrap = true
|
||||
tracks/21/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(45, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_4k813"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_oktsg"),
|
||||
"WalkLeft": ExtResource("3_2eohq"),
|
||||
"idle": ExtResource("2_ymiw5")
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_hn1cf"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1x8ew"]
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_myrjl"]
|
||||
animation = &"WalkLeft"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_dx8h8"]
|
||||
animation = &"idle"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_vrcgu"]
|
||||
animation = &"player_WalkLeft"
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ogkr4"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_giw8e"]
|
||||
animation = &"player_WalkRight"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ylw4m"]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_q2u5u"]
|
||||
advance_mode = 2
|
||||
advance_condition = &"WalkLeft"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_tx8bg"]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0oq83"]
|
||||
advance_mode = 2
|
||||
advance_condition = &"Idle"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_flw2n"]
|
||||
advance_mode = 2
|
||||
advance_condition = &"Idle"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_um8f6"]
|
||||
advance_mode = 2
|
||||
advance_condition = &"WalkRight"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ks6oc"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_x16w7"]
|
||||
states/BlendTree/node = SubResource("AnimationNodeBlendTree_hn1cf")
|
||||
states/BlendTree/position = Vector2(668, 238)
|
||||
states/End/position = Vector2(328, 289)
|
||||
states/Start/position = Vector2(585, 52)
|
||||
states/idle/node = SubResource("AnimationNodeAnimation_1x8ew")
|
||||
states/idle/position = Vector2(343, 98)
|
||||
states/player_WalkLeft/node = SubResource("AnimationNodeAnimation_vrcgu")
|
||||
states/player_WalkLeft/position = Vector2(224, 185)
|
||||
states/player_WalkRight/node = SubResource("AnimationNodeAnimation_giw8e")
|
||||
states/player_WalkRight/position = Vector2(451, 185)
|
||||
transitions = ["idle", "player_WalkLeft", SubResource("AnimationNodeStateMachineTransition_ylw4m"), "player_WalkLeft", "idle", SubResource("AnimationNodeStateMachineTransition_tx8bg"), "player_WalkRight", "idle", SubResource("AnimationNodeStateMachineTransition_flw2n"), "idle", "player_WalkRight", SubResource("AnimationNodeStateMachineTransition_um8f6"), "Start", "player_WalkRight", SubResource("AnimationNodeStateMachineTransition_ks6oc")]
|
||||
graph_offset = Vector2(-101, 1)
|
||||
states/Start/position = Vector2(371, 25)
|
||||
states/WalkLeft/node = SubResource("AnimationNodeAnimation_myrjl")
|
||||
states/WalkLeft/position = Vector2(534, 122)
|
||||
states/idle/node = SubResource("AnimationNodeAnimation_dx8h8")
|
||||
states/idle/position = Vector2(371, 111)
|
||||
transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition_ogkr4"), "idle", "WalkLeft", SubResource("AnimationNodeStateMachineTransition_q2u5u"), "WalkLeft", "idle", SubResource("AnimationNodeStateMachineTransition_0oq83")]
|
||||
graph_offset = Vector2(-48, -19)
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_wgp38"]
|
||||
graph_offset = Vector2(-281.833, 96.4845)
|
||||
nodes/Locomotion/node = SubResource("AnimationNodeStateMachine_x16w7")
|
||||
nodes/Locomotion/position = Vector2(120, 140)
|
||||
nodes/output/position = Vector2(340, 140)
|
||||
nodes/Locomotion/position = Vector2(180, 120)
|
||||
nodes/output/position = Vector2(380, 120)
|
||||
node_connections = [&"output", 0, &"Locomotion"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_dgcsv"]
|
||||
font_size = 50
|
||||
|
||||
[sub_resource type="CanvasTexture" id="CanvasTexture_2b3h6"]
|
||||
diffuse_texture = ExtResource("4_ytgpb")
|
||||
|
||||
|
@ -234,7 +307,7 @@ diffuse_texture = ExtResource("4_ytgpb")
|
|||
script = ExtResource("1_0pgv8")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -129)
|
||||
position = Vector2(0, -75)
|
||||
shape = SubResource("RectangleShape2D_kapu3")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
|
@ -258,75 +331,59 @@ tree_root = SubResource("AnimationNodeBlendTree_wgp38")
|
|||
anim_player = NodePath("../AnimationPlayer")
|
||||
parameters/Locomotion/conditions/Idle = false
|
||||
parameters/Locomotion/conditions/WalkLeft = false
|
||||
parameters/Locomotion/conditions/WalkRight = false
|
||||
|
||||
[node name="debug" type="Label" parent="."]
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -188.5
|
||||
offset_top = -801.0
|
||||
offset_right = 188.5
|
||||
offset_bottom = -680.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
auto_translate = false
|
||||
localize_numeral_system = false
|
||||
text = "debug"
|
||||
label_settings = SubResource("LabelSettings_dgcsv")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Skeleton2D" type="Skeleton2D" parent="."]
|
||||
position = Vector2(17, 0)
|
||||
|
||||
[node name="BootL" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(42, -41)
|
||||
position = Vector2(39.7013, -40.9008)
|
||||
rotation = -0.509857
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("2_45h8h")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(896, 768, 128, 128)
|
||||
|
||||
[node name="BootR" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(-71, -48)
|
||||
position = Vector2(-69.1147, -47.8842)
|
||||
rotation = 0.472078
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("2_45h8h")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(896, 768, 128, 128)
|
||||
|
||||
[node name="Body" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(51, -227.086)
|
||||
position = Vector2(51, -222)
|
||||
texture = ExtResource("2_45h8h")
|
||||
offset = Vector2(-15, 0)
|
||||
region_enabled = true
|
||||
region_rect = Rect2(0, 640, 384, 384)
|
||||
|
||||
[node name="HandL" type="Sprite2D" parent="Skeleton2D/Body"]
|
||||
position = Vector2(-21.1837, 56.4427)
|
||||
position = Vector2(33, 58)
|
||||
texture = ExtResource("2_45h8h")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(768, 768, 128, 128)
|
||||
|
||||
[node name="HandR" type="Sprite2D" parent="Skeleton2D/Body"]
|
||||
show_behind_parent = true
|
||||
position = Vector2(-153.296, 34.1959)
|
||||
position = Vector2(-151, 31)
|
||||
texture = ExtResource("2_45h8h")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(768, 768, 128, 128)
|
||||
|
||||
[node name="Tail" type="Sprite2D" parent="Skeleton2D/Body"]
|
||||
show_behind_parent = true
|
||||
position = Vector2(44, 97.0863)
|
||||
rotation = -0.0492555
|
||||
scale = Vector2(1, 1)
|
||||
position = Vector2(44, 92)
|
||||
scale = Vector2(0.999991, 0.999991)
|
||||
texture = ExtResource("2_45h8h")
|
||||
offset = Vector2(70, 0)
|
||||
region_enabled = true
|
||||
region_rect = Rect2(768, 640, 256, 128)
|
||||
|
||||
[node name="Head" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(-40, -400.086)
|
||||
rotation = 0.0177547
|
||||
position = Vector2(-40, -395)
|
||||
rotation = 0.00121922
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("2_45h8h")
|
||||
offset = Vector2(0, -168)
|
||||
region_enabled = true
|
||||
|
@ -334,7 +391,7 @@ region_rect = Rect2(0, 0, 512, 640)
|
|||
|
||||
[node name="Hat" type="Sprite2D" parent="Skeleton2D/Head"]
|
||||
position = Vector2(65, -103)
|
||||
scale = Vector2(0.60004, 0.60004)
|
||||
scale = Vector2(0.600959, 0.600959)
|
||||
texture = ExtResource("3_qyf3b")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(0, 0, 1152, 1136)
|
||||
|
@ -349,6 +406,7 @@ rest = Transform2D(1, 0, 0, 1, -18, -93)
|
|||
|
||||
[node name="LegLeft" type="Bone2D" parent="Skeleton2D/root/Hips"]
|
||||
position = Vector2(77, 52)
|
||||
scale = Vector2(1, 1)
|
||||
rest = Transform2D(1, 0, 0, 1, 77, 52)
|
||||
|
||||
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/root/Hips/LegLeft"]
|
||||
|
@ -356,6 +414,7 @@ remote_path = NodePath("../../../../BootL")
|
|||
|
||||
[node name="LegRight" type="Bone2D" parent="Skeleton2D/root/Hips"]
|
||||
position = Vector2(-36, 45)
|
||||
scale = Vector2(1, 1)
|
||||
rest = Transform2D(1, 0, 0, 1, -36, 45)
|
||||
|
||||
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/root/Hips/LegRight"]
|
||||
|
@ -367,6 +426,7 @@ rest = Transform2D(1, 0, 0, 1, 86, -129)
|
|||
|
||||
[node name="Head" type="Bone2D" parent="Skeleton2D/root/Hips/Spine"]
|
||||
position = Vector2(-91, -173)
|
||||
scale = Vector2(1, 1)
|
||||
rest = Transform2D(1, 0, 0, 1, -91, -173)
|
||||
|
||||
[node name="Hat" type="Bone2D" parent="Skeleton2D/root/Hips/Spine/Head"]
|
||||
|
@ -400,7 +460,6 @@ update_scale = false
|
|||
|
||||
[node name="Tail" type="Bone2D" parent="Skeleton2D/root/Hips"]
|
||||
position = Vector2(130, -37)
|
||||
scale = Vector2(1, 1)
|
||||
rest = Transform2D(1, 0, 0, 1, 130, -37)
|
||||
|
||||
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/root/Hips/Tail"]
|
||||
|
|
BIN
player/animations/WalkLeft.res
(Stored with Git LFS)
Normal file
BIN
player/animations/WalkLeft.res
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
player/animations/WalkRight.res
(Stored with Git LFS)
Normal file
BIN
player/animations/WalkRight.res
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
player/animations/idle.res
(Stored with Git LFS)
BIN
player/animations/idle.res
(Stored with Git LFS)
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
[gd_resource type="CanvasTexture" load_steps=2 format=3 uid="uid://5pmqr3y62guu"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dptor7en7li7e" path="res://player/hermandad-black.png" id="1_bh8p5"]
|
||||
[ext_resource type="Texture2D" uid="uid://dc0ryln54y2hw" path="res://player/archer.png" id="1_31kra"]
|
||||
|
||||
[resource]
|
||||
diffuse_texture = ExtResource("1_bh8p5")
|
||||
diffuse_texture = ExtResource("1_31kra")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[gd_resource type="CanvasTexture" load_steps=2 format=3 uid="uid://5qixrbrclydr"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://pkf86c0n3xig" path="res://extracted/Texture2D/Whitch Hat #62998.png" id="1_7652k"]
|
||||
[ext_resource type="Texture2D" uid="uid://0m4sejstlmy7" path="res://extracted/Texture2D/Hat Glasses.png" id="1_ogipp"]
|
||||
|
||||
[resource]
|
||||
diffuse_texture = ExtResource("1_7652k")
|
||||
diffuse_texture = ExtResource("1_ogipp")
|
||||
|
|
Loading…
Reference in a new issue