strafing now good
i forgor what i added here just roll with it
This commit is contained in:
parent
ce3b36d9fe
commit
42bddd5e87
7 changed files with 93 additions and 57 deletions
|
|
@ -24,6 +24,8 @@ size = Vector3(20.447998, 11.038544, 1)
|
||||||
[sub_resource type="Environment" id="Environment_b5l5s"]
|
[sub_resource type="Environment" id="Environment_b5l5s"]
|
||||||
background_mode = 2
|
background_mode = 2
|
||||||
background_energy_multiplier = 2.36
|
background_energy_multiplier = 2.36
|
||||||
|
volumetric_fog_enabled = true
|
||||||
|
volumetric_fog_density = 0.111
|
||||||
|
|
||||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_60a4j"]
|
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_60a4j"]
|
||||||
dof_blur_far_distance = 16.46
|
dof_blur_far_distance = 16.46
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ general/updates_per_second=100
|
||||||
|
|
||||||
config/name="breadwinner"
|
config/name="breadwinner"
|
||||||
config/features=PackedStringArray("4.7", "Forward Plus")
|
config/features=PackedStringArray("4.7", "Forward Plus")
|
||||||
|
run/max_fps=90
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
[audio]
|
[audio]
|
||||||
|
|
|
||||||
|
|
@ -26,26 +26,30 @@ func toggle_flashlight():
|
||||||
flashlight.visible = !flashlight.visible
|
flashlight.visible = !flashlight.visible
|
||||||
sound_controller.play_flashlight_sound()
|
sound_controller.play_flashlight_sound()
|
||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
#handle grabbed object
|
if not Console.toggled and not player_state.in_menu:
|
||||||
if held_object != null:
|
mouse_motion.y = clamp(mouse_motion.y, -1560, 1560)
|
||||||
var target_pos = hold_position.global_position
|
player.transform.basis = lerp(player.transform.basis, Basis.from_euler(Vector3(0, mouse_motion.x * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0)), delta * 30)
|
||||||
var current_pos = held_object.global_position
|
camera.transform.basis = lerp(camera.transform.basis, Basis.from_euler(Vector3(mouse_motion.y * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0, 0)), delta * 30)
|
||||||
var direction = target_pos - current_pos
|
#handle grabbed object
|
||||||
|
if held_object != null:
|
||||||
held_object.linear_velocity = direction * PlayerConsts.GRAB_POWER
|
var target_pos = hold_position.global_position
|
||||||
|
var current_pos = held_object.global_position
|
||||||
var current_quat = held_object.global_transform.basis.get_rotation_quaternion()
|
var direction = target_pos - current_pos
|
||||||
var target_quat = hold_position.global_transform.basis.get_rotation_quaternion()
|
|
||||||
|
|
||||||
var delta_quat = target_quat * current_quat.inverse()
|
|
||||||
var angle = delta_quat.get_angle()
|
|
||||||
var axis = delta_quat.get_axis()
|
|
||||||
|
|
||||||
if angle > PI:
|
|
||||||
angle -= TAU
|
|
||||||
|
|
||||||
held_object.angular_velocity = axis * angle * PlayerConsts.GRAB_ROTATION_POWER
|
held_object.linear_velocity = direction * PlayerConsts.GRAB_POWER
|
||||||
|
|
||||||
|
var current_quat = held_object.global_transform.basis.get_rotation_quaternion()
|
||||||
|
var target_quat = hold_position.global_transform.basis.get_rotation_quaternion()
|
||||||
|
|
||||||
|
var delta_quat = target_quat * current_quat.inverse()
|
||||||
|
var angle = delta_quat.get_angle()
|
||||||
|
var axis = delta_quat.get_axis()
|
||||||
|
|
||||||
|
if angle > PI:
|
||||||
|
angle -= TAU
|
||||||
|
|
||||||
|
held_object.angular_velocity = axis * angle * PlayerConsts.GRAB_ROTATION_POWER
|
||||||
|
|
||||||
func handle_joypad_movement(delta: float):
|
func handle_joypad_movement(delta: float):
|
||||||
var controller_look_vector = Input.get_vector("look_left", "look_right", "look_up", "look_down") * 50
|
var controller_look_vector = Input.get_vector("look_left", "look_right", "look_up", "look_down") * 50
|
||||||
|
|
@ -71,14 +75,10 @@ func _input(event: InputEvent) -> void:
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if Input.is_action_just_pressed("open_menu"):
|
if Input.is_action_just_pressed("open_menu"):
|
||||||
ui_handler.toggle_menu()
|
ui_handler.toggle_menu()
|
||||||
|
|
||||||
if !Console.toggled and not player_state.in_menu:
|
if !Console.toggled and not player_state.in_menu:
|
||||||
handle_joypad_movement(delta)
|
handle_joypad_movement(delta)
|
||||||
|
|
||||||
mouse_motion.y = clamp(mouse_motion.y, -1560, 1560)
|
|
||||||
player.transform.basis = Basis.from_euler(Vector3(0, mouse_motion.x * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0))
|
|
||||||
camera.transform.basis = lerp(camera.transform.basis, Basis.from_euler(Vector3(mouse_motion.y * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0, 0)), delta * 10)
|
|
||||||
|
|
||||||
if Input.is_action_just_pressed("next_item"):
|
if Input.is_action_just_pressed("next_item"):
|
||||||
player_manager.next_item()
|
player_manager.next_item()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ expand_mode = 1
|
||||||
|
|
||||||
[node name="StaminaReset" type="Timer" parent="." unique_id=1815815085]
|
[node name="StaminaReset" type="Timer" parent="." unique_id=1815815085]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
wait_time = 5.214
|
wait_time = 3.0
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[node name="SoundEmitters" type="Node3D" parent="." unique_id=661429541]
|
[node name="SoundEmitters" type="Node3D" parent="." unique_id=661429541]
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,6 @@ func _ready() -> void:
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if stamina_recharge:
|
if stamina_recharge:
|
||||||
stamina = move_toward(stamina, 100, .5 * delta)
|
stamina = move_toward(stamina, 100, 10 * delta)
|
||||||
if flashlight.visible:
|
if flashlight.visible:
|
||||||
flashlight_power = move_toward(flashlight_power, 0, .2 * delta)
|
flashlight_power = move_toward(flashlight_power, 0, .2 * delta)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_m6sn8"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_m6sn8"]
|
||||||
bg_color = Color(0.23921569, 0.23921569, 0.23921569, 0.47058824)
|
bg_color = Color(0.23921569, 0.23921569, 0.23921569, 0.47058824)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b5l5s"]
|
||||||
|
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||||
|
|
||||||
[node name="PlayerUi" type="Control" unique_id=454848358]
|
[node name="PlayerUi" type="Control" unique_id=454848358]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
|
|
@ -108,46 +111,74 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_m6sn8")
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="StaminaBarMargin" type="MarginContainer" parent="." unique_id=707986637]
|
[node name="CenterContainer2" type="Control" parent="." unique_id=772146403]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = -1
|
anchor_left = 0.7
|
||||||
anchor_left = 0.07
|
anchor_top = 0.65
|
||||||
anchor_top = 0.85
|
anchor_right = 1.0
|
||||||
anchor_right = 0.27
|
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="StaminaBarMargin" type="PanelContainer" parent="CenterContainer2" unique_id=2079111724]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_top = 0.2
|
||||||
|
anchor_right = 0.7
|
||||||
|
anchor_bottom = 0.8
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
rotation = 0.34906584
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
theme_override_constants/margin_left = 0
|
theme_override_styles/panel = SubResource("StyleBoxFlat_b5l5s")
|
||||||
theme_override_constants/margin_right = 0
|
|
||||||
|
|
||||||
[node name="StaminaBar" type="ProgressBar" parent="StaminaBarMargin" unique_id=1844702202]
|
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer2/StaminaBarMargin" unique_id=1659237850]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CenterContainer2/StaminaBarMargin/VBoxContainer" unique_id=37159973]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Flashlight"
|
||||||
|
horizontal_alignment = 2
|
||||||
|
|
||||||
|
[node name="FlashlightBar" type="ProgressBar" parent="CenterContainer2/StaminaBarMargin/VBoxContainer" unique_id=487706195]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(0, 50)
|
custom_minimum_size = Vector2(0, 50)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
offset_transform_enabled = true
|
offset_transform_enabled = true
|
||||||
offset_transform_rotation = -0.34906584
|
|
||||||
show_percentage = false
|
|
||||||
|
|
||||||
[node name="FlashlightBarMargin" type="MarginContainer" parent="." unique_id=915568145]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = -1
|
|
||||||
anchor_left = 0.73
|
|
||||||
anchor_top = 0.85
|
|
||||||
anchor_right = 0.93
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
offset_left = -4.0
|
|
||||||
offset_top = -4.0
|
|
||||||
grow_horizontal = 0
|
|
||||||
grow_vertical = 0
|
|
||||||
size_flags_horizontal = 4
|
|
||||||
size_flags_vertical = 4
|
|
||||||
|
|
||||||
[node name="FlashlightBar" type="ProgressBar" parent="FlashlightBarMargin" unique_id=551784534]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
custom_minimum_size = Vector2(50, 50)
|
|
||||||
layout_mode = 2
|
|
||||||
offset_transform_enabled = true
|
|
||||||
offset_transform_rotation = 0.34906584
|
|
||||||
fill_mode = 1
|
fill_mode = 1
|
||||||
show_percentage = false
|
show_percentage = false
|
||||||
|
|
||||||
|
[node name="CenterContainer" type="Control" parent="." unique_id=86499814]
|
||||||
|
layout_mode = 1
|
||||||
|
anchor_top = 0.81
|
||||||
|
anchor_right = 0.3
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="StaminaBarMargin" type="PanelContainer" parent="CenterContainer" unique_id=1687637803]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_left = 0.3
|
||||||
|
anchor_top = 0.2
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 0.8
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
rotation = -0.34906584
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 4
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_b5l5s")
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/StaminaBarMargin" unique_id=162758047]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CenterContainer/StaminaBarMargin/VBoxContainer" unique_id=976233035]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Stamina"
|
||||||
|
|
||||||
|
[node name="StaminaBar" type="ProgressBar" parent="CenterContainer/StaminaBarMargin/VBoxContainer" unique_id=1844702202]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(0, 50)
|
||||||
|
layout_mode = 2
|
||||||
|
offset_transform_enabled = true
|
||||||
|
show_percentage = false
|
||||||
|
|
|
||||||
|
|
@ -49,12 +49,14 @@ func toggle_menu():
|
||||||
cursor.visible = false
|
cursor.visible = false
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
player_state.in_menu = true
|
player_state.in_menu = true
|
||||||
|
prompt.visible = false
|
||||||
else:
|
else:
|
||||||
ui.visible = true
|
ui.visible = true
|
||||||
in_game_menu.visible = false
|
in_game_menu.visible = false
|
||||||
cursor.visible = true
|
cursor.visible = true
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||||
player_state.in_menu = false
|
player_state.in_menu = false
|
||||||
|
prompt.visible = true
|
||||||
|
|
||||||
func set_ui_scale(scale:float) -> void:
|
func set_ui_scale(scale:float) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue