added ADS to revolver
This commit is contained in:
@@ -167,6 +167,7 @@ func _ready():
|
||||
#Cache vars
|
||||
weapon_start_pos = weapon_spawner.position
|
||||
|
||||
|
||||
#turn off audio if unchecked in player
|
||||
if AUDIO == false:
|
||||
AudioServer.set_bus_volume_db(0,-80)
|
||||
@@ -493,7 +494,7 @@ func aim_down_sights(delta):
|
||||
if gun:
|
||||
if gun.ads == true:
|
||||
if ads:
|
||||
camera.fov -= .1
|
||||
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
|
||||
gun.position = lerp(gun.position,ADS_POS,delta * 10 / Engine.time_scale)
|
||||
else:
|
||||
gun.position = lerp(gun.position, weapon_start_pos,delta * 2)
|
||||
@@ -531,18 +532,22 @@ func _on_pick_up_magnet_body_entered(body):
|
||||
body.collision_shape.disabled = true
|
||||
|
||||
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 * HEAD_TILT_AMT, 5 * delta)
|
||||
if !ads:
|
||||
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 * HEAD_TILT_AMT, 5 * delta)
|
||||
|
||||
func weapon_sway(delta):
|
||||
if !ads:
|
||||
if !gun.ads:
|
||||
var joy_input = Vector2(Input.get_joy_axis(0,JOY_AXIS_RIGHT_X)*5,Input.get_joy_axis(0,JOY_AXIS_RIGHT_Y)*5)
|
||||
mouse_input = lerp(mouse_input, Vector2.ZERO, 10 * delta)
|
||||
joy_input = lerp(joy_input,Vector2.ZERO,10 * delta)
|
||||
weapon_holder.rotation.x = lerp(weapon_holder.rotation.x, (mouse_input.y + joy_input.y) * weapon_sway_amount, 5 * delta)
|
||||
weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, (mouse_input.x + joy_input.x) * weapon_sway_amount, 5 * delta)
|
||||
else:
|
||||
if gun.ads == true:
|
||||
weapon_holder.rotation = Vector3.ZERO
|
||||
|
||||
func weapon_bob(vel : float, delta):
|
||||
if weapon_holder:
|
||||
|
||||
Reference in New Issue
Block a user