added dof blur on time slowdown

This commit is contained in:
derek
2025-01-17 16:54:03 -06:00
parent f74d599b64
commit 5978a90017
5 changed files with 29 additions and 7 deletions

View File

@@ -680,7 +680,7 @@ script = ExtResource("2_tskiy")
gun_name = "Mac 10"
gun_icon = ExtResource("3_p1hxc")
gun_info = ExtResource("4_ex2eo")
fov_zoom_amt = 5.0
fov_zoom_amt = 15.0
recoil_amount = Vector3(0.02, 0.05, 0.05)
max_ammo = 20
bullet_damage = 2
@@ -702,7 +702,7 @@ audio_empty = NodePath("Audio/Empty")
audio_reload = NodePath("Audio/Reload")
[node name="mac10" parent="." index="0"]
transform = Transform3D(-1.08301e-06, -8.05098e-08, -0.3, -0.0225093, 0.299154, 9.76371e-10, 0.299154, 0.0225093, -1.086e-06, -0.00876398, 0.0748287, -0.0557729)
transform = Transform3D(-1.08301e-06, -8.05094e-08, -0.3, -0.0225093, 0.299154, 9.76756e-10, 0.299154, 0.0225093, -1.086e-06, -0.00876398, 0.0748287, -0.0557729)
cast_shadow = 0
lod_bias = 10.0
mesh = SubResource("ArrayMesh_pcg38")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=34 format=3 uid="uid://drwae3loscbw7"]
[gd_scene load_steps=35 format=3 uid="uid://drwae3loscbw7"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_x7wms"]
[ext_resource type="Script" path="res://scripts/recoil.gd" id="3_405jc"]
@@ -35,6 +35,11 @@ height = 2.03547
radius = 0.509802
height = 1.19106
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_vhypf"]
dof_blur_far_enabled = true
dof_blur_near_enabled = true
dof_blur_amount = 0.3
[sub_resource type="FastNoiseLite" id="FastNoiseLite_vupcx"]
noise_type = 0
frequency = 0.05
@@ -116,6 +121,7 @@ script = ExtResource("3_405jc")
[node name="Camera3D" type="Camera3D" parent="Head/Recoil"]
transform = Transform3D(1, -8.30784e-09, 2.09548e-09, 7.50333e-12, 1, -6.0536e-09, 0, 0, 1, 1.29921e-05, -0.0445602, -0.00379455)
cull_mask = 1048573
attributes = SubResource("CameraAttributesPractical_vhypf")
current = true
[node name="WeaponHolder" type="Node3D" parent="Head/Recoil/Camera3D"]

View File

@@ -1343,7 +1343,7 @@ gun_name = ".44 Galore"
gun_icon = ExtResource("3_nl201")
ammo_type = 1
fire_mode = 1
fov_zoom_amt = 15
fov_zoom_amt = 35
recoil_amount = Vector3(0.125, 0.1, 0.1)
max_ammo = 6
bullet_damage = 5

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=3 uid="uid://dsnddbrlqkav2"]
[gd_scene load_steps=22 format=3 uid="uid://dsnddbrlqkav2"]
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_laua1"]
[ext_resource type="PackedScene" uid="uid://brl0bsqjl5dg3" path="res://assets/mac_10.tscn" id="2_poauc"]
@@ -15,6 +15,7 @@
[ext_resource type="PackedScene" uid="uid://by3n26uvps8tb" path="res://assets/water_tower.tscn" id="14_yn32s"]
[ext_resource type="PackedScene" uid="uid://cgo4qyul7ix5p" path="res://assets/ladder.tscn" id="15_bsva3"]
[ext_resource type="PackedScene" uid="uid://cdpxctwwi12j" path="res://assets/ladder_collision_check.tscn" id="15_vb271"]
[ext_resource type="PackedScene" uid="uid://bj1y0fbjtul4a" path="res://post_processing.tscn" id="16_p7sg0"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_w6vpl"]
sky_top_color = Color(0.623488, 0.812575, 0.900791, 1)
@@ -229,3 +230,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -12.7187, -0.500688, -37.3549
[node name="Ladder" parent="." instance=ExtResource("15_bsva3")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -12.7245, -0.170555, -36.0291)
[node name="PostProcessing" parent="." instance=ExtResource("16_p7sg0")]

View File

@@ -18,7 +18,7 @@ const STAMINA_DRAIN = 20
const HEAD_TILT_AMT = .06
const BOB_FREQ = 1.7
const BOB_AMP = 0.1
const ADS_POS = Vector3(0,-.05,-.45)
const ADS_POS = Vector3(0,-.05,-.3)
#JOYSTICK SETTINGS
const JOYSTICK_SENSITIVITY = .06
@@ -463,6 +463,7 @@ func _physics_process(delta):
if level_control.health <= 0:
level_control.die()
focus_on_target()
joypad_look(delta)
aim_down_sights(delta)
flashlight_toggle()
@@ -545,7 +546,9 @@ func aim_down_sights(delta):
gun.position = lerp(gun.position,ADS_POS,delta * 10 / Engine.time_scale)
else:
gun.position = lerp(gun.position, weapon_start_pos,delta * 2)
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 4)/Engine.time_scale)
else:
gun.position = lerp(gun.position, weapon_start_pos,delta * 10)
func grab_moveable(body):
holster_gun(true)
@@ -656,6 +659,16 @@ func pickup_apply(type,ammo_type,value):
level_control.money += value
func focus_on_target():
if Engine.time_scale < 1:
const BLUR_AMOUNT = .1
camera.attributes.dof_blur_far_enabled = false
camera.attributes.dof_blur_near_enabled = true
camera.attributes.dof_blur_amount = lerp(0.0,BLUR_AMOUNT,1.0 - Engine.time_scale)
else:
camera.attributes.dof_blur_far_enabled = false
camera.attributes.dof_blur_near_enabled = false
func weapon_tilt(input_x, delta):
if !ads:
if weapon_holder: