tweaked crouch slide

This commit is contained in:
derek
2024-12-09 14:18:43 -06:00
parent a1518945d4
commit fee4abaa9d
7 changed files with 68 additions and 51 deletions

View File

@@ -15,6 +15,7 @@ const STAND_POS = Vector3(0,0.889,0)
const SLOWSPEED = .1
const MAX_STAMINA : float = 100
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)
@@ -228,10 +229,11 @@ func _physics_process(delta):
else:
crouched = !crouched
recoil.add_recoil(Vector3(.2,0,0),5,10)
crouch_audio.play()
velocity.y -= 15
if is_on_floor():
crouch_audio.play()
velocity += direction * 20
else:
velocity.y -= 15
#walking
if is_on_floor() and !is_climbing:
@@ -454,8 +456,10 @@ func _headbob(time) -> Vector3:
var pos = Vector3.ZERO
pos.y = sin(time * BOB_FREQ) * BOB_AMP
pos.x = cos(time * BOB_FREQ / 2) * BOB_AMP
if pos.y >= .07 and is_on_floor() and velocity.length() >= 1 and !footstep_sound.is_playing():
footstep_sound.play()
return pos
@@ -485,7 +489,7 @@ func weapon_tilt(input_x, delta):
if weapon_holder:
weapon_holder.rotation.z = lerp(weapon_holder.rotation.z, -input_x * weapon_rotation_amount * 10, 4 * delta)
if camera:
camera.rotation.z = lerp(camera.rotation.z, -input_x * .075, 5 * delta)
camera.rotation.z = lerp(camera.rotation.z, -input_x * HEAD_TILT_AMT, 5 * delta)
func weapon_sway(delta):
if !ads: