Speed
This commit is contained in:
parent
989121ada1
commit
7417dcfade
2 changed files with 45 additions and 86 deletions
|
@ -1,7 +1,7 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
|
||||
const SPEED = 500.0
|
||||
const SPEED = 700.0
|
||||
|
||||
func get_input():
|
||||
var directionX = Input.get_axis("move_left", "move_right")
|
||||
|
@ -21,6 +21,8 @@ func get_input():
|
|||
$Skeleton2D/root/Hips.set_scale(Vector2(1, 1))
|
||||
if (directionX > 0):
|
||||
$Skeleton2D/root/Hips.set_scale(Vector2(-1, 1))
|
||||
|
||||
$AnimationTree.set("parameters/WalkRun/blend_position",max(abs(velocity.x),abs(velocity.y)))
|
||||
#endregion
|
||||
|
||||
func _physics_process(delta):
|
||||
|
|
127
player.tscn
127
player.tscn
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=30 format=3 uid="uid://0m1hk2nu4bps"]
|
||||
[gd_scene load_steps=20 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"]
|
||||
|
@ -444,84 +444,45 @@ _data = {
|
|||
"idle": ExtResource("2_ymiw5")
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_ydofw"]
|
||||
filters = ["Skeleton2D/root/Hips/LegLeft:position:x", "Skeleton2D/root/Hips/LegLeft:position:y", "Skeleton2D/root/Hips/LegLeft:rotation", "Skeleton2D/root/Hips/LegRight:position:x", "Skeleton2D/root/Hips/LegRight:position:y", "Skeleton2D/root/Hips/LegRight:rotation"]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_hn1cf"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_myrjl"]
|
||||
animation = &"WalkLeft"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_50xfb"]
|
||||
animation = &"WalkRight"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_i0qvo"]
|
||||
animation = &"WalkLeft"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ml43n"]
|
||||
animation = &"WalkRight"
|
||||
|
||||
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_l88j3"]
|
||||
blend_point_0/node = SubResource("AnimationNodeAnimation_i0qvo")
|
||||
blend_point_0/pos = Vector2(-1, 0)
|
||||
blend_point_1/node = SubResource("AnimationNodeAnimation_ml43n")
|
||||
blend_point_1/pos = Vector2(1, 0)
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_dx8h8"]
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_paj7q"]
|
||||
animation = &"idle"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ogkr4"]
|
||||
advance_mode = 2
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_w0twr"]
|
||||
animation = &"Walk"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_q2u5u"]
|
||||
advance_mode = 2
|
||||
advance_condition = &"WalkLeft"
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_17l2l"]
|
||||
animation = &"Walk"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0oq83"]
|
||||
xfade_time = 0.2
|
||||
advance_mode = 2
|
||||
advance_condition = &"Idle"
|
||||
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_66x5k"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_p8n5f"]
|
||||
advance_mode = 2
|
||||
advance_condition = &"WalkRight"
|
||||
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_p4347"]
|
||||
graph_offset = Vector2(-455.578, -2.44228)
|
||||
nodes/Animation/node = SubResource("AnimationNodeAnimation_17l2l")
|
||||
nodes/Animation/position = Vector2(-160, 140)
|
||||
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_66x5k")
|
||||
nodes/TimeScale/position = Vector2(60, 120)
|
||||
nodes/output/position = Vector2(280, 120)
|
||||
node_connections = [&"TimeScale", 0, &"Animation", &"output", 0, &"TimeScale"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_yhvwn"]
|
||||
xfade_time = 0.2
|
||||
advance_mode = 2
|
||||
advance_condition = &"Idle"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_xfa3x"]
|
||||
advance_mode = 2
|
||||
advance_condition = &"WalkLeft"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_m2u4j"]
|
||||
advance_mode = 2
|
||||
advance_condition = &"WalkRight"
|
||||
|
||||
[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(132, -10)
|
||||
states/WalkLeft/node = SubResource("AnimationNodeAnimation_myrjl")
|
||||
states/WalkLeft/position = Vector2(-72, 143)
|
||||
states/WalkRight/node = SubResource("AnimationNodeAnimation_50xfb")
|
||||
states/WalkRight/position = Vector2(304, 143)
|
||||
states/Walkspace/node = SubResource("AnimationNodeBlendSpace2D_l88j3")
|
||||
states/Walkspace/position = Vector2(487, 126)
|
||||
states/idle/node = SubResource("AnimationNodeAnimation_dx8h8")
|
||||
states/idle/position = Vector2(138, 66)
|
||||
transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition_ogkr4"), "idle", "WalkLeft", SubResource("AnimationNodeStateMachineTransition_q2u5u"), "WalkLeft", "idle", SubResource("AnimationNodeStateMachineTransition_0oq83"), "idle", "WalkRight", SubResource("AnimationNodeStateMachineTransition_p8n5f"), "WalkRight", "idle", SubResource("AnimationNodeStateMachineTransition_yhvwn"), "WalkRight", "WalkLeft", SubResource("AnimationNodeStateMachineTransition_xfa3x"), "WalkLeft", "WalkRight", SubResource("AnimationNodeStateMachineTransition_m2u4j")]
|
||||
graph_offset = Vector2(-292, -6)
|
||||
[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_c82tj"]
|
||||
blend_point_0/node = SubResource("AnimationNodeAnimation_paj7q")
|
||||
blend_point_0/pos = 0.0
|
||||
blend_point_1/node = SubResource("AnimationNodeAnimation_w0twr")
|
||||
blend_point_1/pos = 500.0
|
||||
blend_point_2/node = SubResource("AnimationNodeBlendTree_p4347")
|
||||
blend_point_2/pos = 700.0
|
||||
min_space = 0.0
|
||||
max_space = 700.0
|
||||
snap = 10.0
|
||||
value_label = "speed"
|
||||
sync = true
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_wgp38"]
|
||||
nodes/Blend2/node = SubResource("AnimationNodeBlend2_ydofw")
|
||||
nodes/Blend2/position = Vector2(380, 180)
|
||||
nodes/Locomotion/node = SubResource("AnimationNodeStateMachine_x16w7")
|
||||
nodes/Locomotion/position = Vector2(100, 120)
|
||||
nodes/output/position = Vector2(380, 120)
|
||||
node_connections = [&"output", 0, &"Locomotion"]
|
||||
graph_offset = Vector2(-55.7817, 106.547)
|
||||
nodes/WalkRun/node = SubResource("AnimationNodeBlendSpace1D_c82tj")
|
||||
nodes/WalkRun/position = Vector2(180, 120)
|
||||
nodes/output/position = Vector2(440, 120)
|
||||
node_connections = [&"output", 0, &"WalkRun"]
|
||||
|
||||
[sub_resource type="CanvasTexture" id="CanvasTexture_2b3h6"]
|
||||
diffuse_texture = ExtResource("4_ytgpb")
|
||||
|
@ -550,34 +511,30 @@ autoplay = "idle"
|
|||
playback_default_blend_time = 0.3
|
||||
|
||||
[node name="AnimationTree" type="AnimationTree" parent="." groups=["Animation"]]
|
||||
active = false
|
||||
tree_root = SubResource("AnimationNodeBlendTree_wgp38")
|
||||
anim_player = NodePath("../AnimationPlayer")
|
||||
parameters/Blend2/blend_amount = 0
|
||||
parameters/Locomotion/conditions/Idle = true
|
||||
parameters/Locomotion/conditions/WalkLeft = false
|
||||
parameters/Locomotion/conditions/WalkRight = false
|
||||
parameters/Locomotion/Walkspace/blend_position = Vector2(-0.00198412, 0.923077)
|
||||
parameters/WalkRun/blend_position = 624.221
|
||||
parameters/WalkRun/2/TimeScale/scale = 1.8
|
||||
|
||||
[node name="Skeleton2D" type="Skeleton2D" parent="."]
|
||||
position = Vector2(17, 0)
|
||||
|
||||
[node name="BootL" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(7.14621, -39.4955)
|
||||
rotation = -0.28458
|
||||
position = Vector2(41.976, -40.999)
|
||||
rotation = -0.525599
|
||||
texture = ExtResource("2_45h8h")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(896, 768, 128, 128)
|
||||
|
||||
[node name="BootR" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(-42.4149, -46.2448)
|
||||
rotation = 0.193006
|
||||
position = Vector2(-70.9803, -47.9988)
|
||||
rotation = 0.491578
|
||||
texture = ExtResource("2_45h8h")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(896, 768, 128, 128)
|
||||
|
||||
[node name="Body" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(51, -232.802)
|
||||
position = Vector2(51, -242.428)
|
||||
texture = ExtResource("2_45h8h")
|
||||
offset = Vector2(-15, 0)
|
||||
region_enabled = true
|
||||
|
@ -598,7 +555,7 @@ region_rect = Rect2(768, 768, 128, 128)
|
|||
|
||||
[node name="Tail" type="Sprite2D" parent="Skeleton2D/Body"]
|
||||
show_behind_parent = true
|
||||
position = Vector2(44, 102.802)
|
||||
position = Vector2(44, 112.428)
|
||||
rotation = 0.153589
|
||||
texture = ExtResource("2_45h8h")
|
||||
offset = Vector2(70, 0)
|
||||
|
@ -606,8 +563,8 @@ region_enabled = true
|
|||
region_rect = Rect2(768, 640, 256, 128)
|
||||
|
||||
[node name="Head" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(-40, -405.802)
|
||||
rotation = 0.0245451
|
||||
position = Vector2(-40, -415.428)
|
||||
rotation = 1.31553e-05
|
||||
texture = ExtResource("2_45h8h")
|
||||
offset = Vector2(0, -168)
|
||||
region_enabled = true
|
||||
|
|
Loading…
Reference in a new issue