Implement jump

This commit is contained in:
Sofia 2026-07-18 00:44:53 +03:00
parent bbb6856185
commit cb0fa40d1a
4 changed files with 32 additions and 10 deletions

View File

@ -23,6 +23,7 @@ GameManagerGlobal="*uid://bii6018k3ip3t"
[display]
window/size/mode=2
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
@ -63,6 +64,11 @@ backward={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
]
}
jump={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
]
}
[physics]

View File

@ -68,19 +68,28 @@ grow_vertical = 0
vertical_alignment = 2
[node name="ready_button" type="Button" parent="." unique_id=311553419]
layout_mode = 0
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 129.0
offset_top = 504.0
offset_top = -177.0
offset_right = 278.0
offset_bottom = 555.0
offset_bottom = -126.0
grow_vertical = 0
text = "Not Ready"
[node name="v_box_container2" type="VBoxContainer" parent="." unique_id=653902328]
layout_mode = 0
offset_left = 716.0
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -329.0
offset_top = 146.0
offset_right = 824.0
offset_right = -221.0
offset_bottom = 204.0
grow_horizontal = 0
[node name="option_button" type="OptionButton" parent="v_box_container2" unique_id=426342653]
layout_mode = 2
metadata/_edit_lock_ = true

View File

@ -16,10 +16,12 @@ size = Vector3(100, 0.01, 100)
[node name="map_0" type="Node3D" unique_id=1710628675]
[node name="net_stats_label" type="NetStatsLabel" parent="." unique_id=1821474986]
offset_left = 1.0
offset_top = 497.0
offset_right = 370.0
offset_bottom = 649.0
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -152.0
offset_right = 369.0
grow_vertical = 0
vertical_alignment = 2
[node name="terrain" type="MeshInstance3D" parent="." unique_id=1474127252]

View File

@ -54,6 +54,11 @@ impl ICharacterBody3D for Player {
let input_direction = if self.locked {
let input = Input::singleton();
if self.base().is_on_floor() && input.is_action_just_pressed("jump") {
self.y_speed = 5.;
}
Vector3::RIGHT * input.is_action_pressed("right") as u32 as f32
- Vector3::RIGHT * input.is_action_pressed("left") as u32 as f32
+ Vector3::FORWARD * input.is_action_pressed("forward") as u32 as f32