minor tweaks from last

This commit is contained in:
derek
2024-07-15 14:27:56 -05:00
parent 53765f7ecd
commit 0e44957853
2 changed files with 7 additions and 7 deletions

View File

@@ -86,7 +86,8 @@ func shoot(player,delta):
if !anim_player.is_playing(): if !anim_player.is_playing():
level_control.ammo_current[gun_index] -= 1 level_control.ammo_current[gun_index] -= 1
#RECOIL --- fix later to happen over a period of time #RECOIL --- fix later to happen over a period of time
player.camera.rotation.x = clamp(lerp(player.camera.rotation.x, player.camera.rotation.x + recoil_amount, delta * 10), deg_to_rad(-90), deg_to_rad(60)) #player.camera.rotation.x = clamp(lerp(player.camera.rotation.x, player.camera.rotation.x + recoil_amount, delta * 10), deg_to_rad(-90), deg_to_rad(60))
player.weapon_recoil(delta)
#(ADD PLAYER KICK HERE. RELATIVE TO GUN POSITION) #(ADD PLAYER KICK HERE. RELATIVE TO GUN POSITION)
audio_fire.pitch_scale = 1 + rng.randf_range(-fire_pitch_scale_amt,fire_pitch_scale_amt) audio_fire.pitch_scale = 1 + rng.randf_range(-fire_pitch_scale_amt,fire_pitch_scale_amt)
audio_fire.play() audio_fire.play()

View File

@@ -245,12 +245,7 @@ func weapon_sway(delta):
mouse_input = lerp(mouse_input, Vector2.ZERO, 10 * delta) mouse_input = lerp(mouse_input, Vector2.ZERO, 10 * delta)
weapon_holder.rotation.x = lerp(weapon_holder.rotation.x, mouse_input.y * weapon_rotation_amount, 5 * delta) weapon_holder.rotation.x = lerp(weapon_holder.rotation.x, mouse_input.y * weapon_rotation_amount, 5 * delta)
weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, mouse_input.x * weapon_rotation_amount, 5 * delta) weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, mouse_input.x * weapon_rotation_amount, 5 * delta)
#crosshair.position.x = lerp(crosshair.position.x, mouse_input.x * 100, 2 * delta)
#crosshair.size.x = lerp(crosshair.size.x, clamp((abs(mouse_input.x * 10) + abs(mouse_input.y) * 1000),0.0,100.0), 1 * delta)
#crosshair.size.y = lerp(crosshair.size.y, clamp((abs(mouse_input.x * 10) + abs(mouse_input.y) * 1000),0.0,100.0), 1 * delta)
func weapon_bob(vel : float, delta): func weapon_bob(vel : float, delta):
if weapon_holder: if weapon_holder:
if vel > 2 and is_on_floor(): if vel > 2 and is_on_floor():
@@ -261,3 +256,7 @@ func weapon_bob(vel : float, delta):
else: else:
weapon_holder.position.y = lerp(weapon_holder.position.y, def_weapon_holder_pos.y, .1 * delta) weapon_holder.position.y = lerp(weapon_holder.position.y, def_weapon_holder_pos.y, .1 * delta)
weapon_holder.position.x = lerp(weapon_holder.position.x, def_weapon_holder_pos.x, .1 * delta) weapon_holder.position.x = lerp(weapon_holder.position.x, def_weapon_holder_pos.x, .1 * delta)
func weapon_recoil(delta):
var recoil_to = camera.rotation.x + gun.recoil_amount
camera.rotation.x = clamp(lerp(camera.rotation.x,recoil_to, delta * 10), deg_to_rad(-90), deg_to_rad(60))