added ADS to revolver
This commit is contained in:
@@ -108,6 +108,7 @@ func _process(delta: float) -> void:
|
||||
if player.ads:
|
||||
if player.gun.ads:
|
||||
fade_in_out(crosshair,1,false,5,delta)
|
||||
fade_in_out(current_stam_bar,.001,true,5,delta)
|
||||
else:
|
||||
fade_in_out(crosshair,1,true,5,delta)
|
||||
else:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -10,7 +10,7 @@ var cycle_count
|
||||
@export var gun_name : String
|
||||
@export var gun_icon : Texture2D
|
||||
@export_enum("Auto", "Single", "Burst") var fire_mode: int
|
||||
@export var fov_zoom_amt = .98
|
||||
@export var fov_zoom_amt = 10
|
||||
@export var ads : bool = false
|
||||
@export var recoil_amount : Vector3 = Vector3(1,.1,.1)
|
||||
@export var recoil_speed_change : float = 4
|
||||
|
||||
Reference in New Issue
Block a user