minor changes

This commit is contained in:
Derek
2024-07-17 21:03:13 -05:00
parent 77b2ecee74
commit 62c0a89c42
11 changed files with 23 additions and 15 deletions

View File

@@ -48,6 +48,7 @@ var recoiling_fade = 0
var bullet_destination
var gun_fire_pitch_starting
var current_weapon_index
var recoiling = false
# Slow Down Variables
const SLOWSPEED = .2
@@ -172,8 +173,8 @@ func _physics_process(delta):
# Gun folding out of the way
if gun_ray.is_colliding() and !gun_ray.get_collider().is_in_group("player"):
#check distance to wall later ?
gun.rotation = lerp(gun.rotation, Vector3(1, 1, -.25), delta * 10)
gun.position = lerp(gun.position, Vector3(gun.start_position.x-.25,gun.start_position.y +.2,gun.start_position.z +.6),(delta*10))
gun.rotation = lerp(gun.rotation, Vector3(1, -1, -.25), delta * 10)
gun.position = lerp(gun.position, Vector3(gun.start_position.x+.25,gun.start_position.y +.2,gun.start_position.z +.6),(delta*10))
gun_folded = true
elif !gun_ray.is_colliding():
gun.rotation = lerp(gun.rotation, gun.start_rotation,delta*7)
@@ -201,6 +202,7 @@ func _physics_process(delta):
if Input.is_action_just_pressed("escape"):
get_tree().quit()
move_and_slide()
weapon_tilt(input_dir.x, delta)
weapon_sway(delta)
@@ -264,7 +266,7 @@ func _on_pick_up_detection_body_entered(body):
var weapon_id = level_control.held_guns.size() - 1
gun.anim_player.play("swap_out")
level_control.gun_spawn(weapon_id)
func _on_pick_up_magnet_body_entered(body):
if body.is_in_group("pickup") and body.is_in_group("magnet"):
@@ -290,6 +292,6 @@ func weapon_bob(vel : float, 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)
func weapon_recoil():
func weapon_recoil(delta):
var recoil_to = camera.rotation.x + gun.recoil_amount
camera.rotation.x = clamp(lerp(camera.rotation.x,recoil_to, .05), deg_to_rad(-90), deg_to_rad(60))