flashlight adjustment, cant fall off map, ui sounds
This commit is contained in:
parent
2ec79e56fc
commit
0ae10c2451
10 changed files with 130 additions and 2 deletions
|
@ -2,6 +2,8 @@ class_name Player extends CharacterBody3D
|
|||
|
||||
@export var current_map: String
|
||||
|
||||
var startPosition: Vector3
|
||||
|
||||
var SPEED_BASE: float = 2
|
||||
var SPEED_CROUCHED: float = 1
|
||||
var SPEED_RUNNING: float = 4
|
||||
|
@ -40,6 +42,7 @@ func _ready() -> void:
|
|||
capture_mouse()
|
||||
if ($Camera.fov != GlobalVariables.FOV):
|
||||
$Camera.fov = GlobalVariables.FOV
|
||||
startPosition = self.position
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if (interact):
|
||||
|
@ -64,6 +67,25 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
pass
|
||||
elif event.is_action_pressed(&"freeroam_debug_menu"):
|
||||
$DebugMenu.visible = !$DebugMenu.visible
|
||||
elif event.is_action_pressed(&"freeroam_respawn"):
|
||||
self.position = startPosition
|
||||
elif event.is_action_pressed(&"freeroam_flashlight_zoom_in"):
|
||||
if ($Camera/Flashlight.visible):
|
||||
if ($Camera/Flashlight.spot_angle > 2):
|
||||
$Camera/Flashlight.spot_angle -= 2
|
||||
$FlashlightSFX.pitch_scale = $Camera/Flashlight.spot_angle/10.0
|
||||
$FlashlightSFX.play()
|
||||
elif event.is_action_pressed(&"freeroam_flashlight_zoom_out"):
|
||||
if ($Camera/Flashlight.visible):
|
||||
if ($Camera/Flashlight.spot_angle < 88):
|
||||
$Camera/Flashlight.spot_angle += 2
|
||||
$FlashlightSFX.pitch_scale = $Camera/Flashlight.spot_angle/10.0
|
||||
$FlashlightSFX.play()
|
||||
elif event.is_action_pressed(&"freeroam_flashlight_zoom_reset"):
|
||||
if ($Camera/Flashlight.visible):
|
||||
$Camera/Flashlight.spot_angle = 30
|
||||
$FlashlightSFX.pitch_scale = $Camera/Flashlight.spot_angle/10.0
|
||||
$FlashlightSFX.play()
|
||||
elif event.is_action_pressed(&"freeroam_camera_zoom_in"):
|
||||
if ($Camera.fov > 2):
|
||||
$Camera.fov -= 2
|
||||
|
@ -121,6 +143,9 @@ func _physics_process(delta: float) -> void:
|
|||
if mouse_captured: _handle_joypad_camera_rotation(delta)
|
||||
velocity = _walk(delta) + _gravity(delta) + _jump(delta)
|
||||
move_and_slide()
|
||||
if (self.position.y < -20):
|
||||
jump_vel = Vector3(0, 50, 0)
|
||||
$BoingSFX.play()
|
||||
|
||||
func capture_mouse() -> void:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://cdk6hwb4hi2wc"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://cdk6hwb4hi2wc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b0c02p6ckmpdq" path="res://Scripts/Player/Player.gd" id="1_2f8j2"]
|
||||
[ext_resource type="PackedScene" uid="uid://cd67bfok34xhy" path="res://Scenes/GUI/InGameMenu.tscn" id="2_0s4r2"]
|
||||
[ext_resource type="PackedScene" uid="uid://fjveglbs1vfv" path="res://Scenes/GUI/DebugMenu.tscn" id="3_ejydr"]
|
||||
[ext_resource type="AudioStream" uid="uid://gu2qnrfyvk0m" path="res://UI/Sounds/boing.wav" id="4_7s4cc"]
|
||||
[ext_resource type="AudioStream" uid="uid://bd13mqgeswusd" path="res://UI/Sounds/flashlight_click.wav" id="5_nckbs"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ejydr"]
|
||||
radius = 0.3
|
||||
|
@ -25,6 +27,7 @@ visible = false
|
|||
light_color = Color(1, 0.960784, 0.85098, 1)
|
||||
light_energy = 5.0
|
||||
shadow_enabled = true
|
||||
shadow_bias = 1.0
|
||||
spot_range = 1000.0
|
||||
spot_angle = 30.0
|
||||
spot_angle_attenuation = 0.25
|
||||
|
@ -35,3 +38,10 @@ mouse_filter = 2
|
|||
|
||||
[node name="InGameMenu" parent="." instance=ExtResource("2_0s4r2")]
|
||||
visible = false
|
||||
|
||||
[node name="BoingSFX" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_7s4cc")
|
||||
|
||||
[node name="FlashlightSFX" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("5_nckbs")
|
||||
volume_db = -1.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue