instancing start gun and assigned ammo to array

This commit is contained in:
derek
2024-07-15 12:16:54 -05:00
parent a18fb55e8d
commit 4da08f3df5
4 changed files with 39 additions and 19 deletions

View File

@@ -72,17 +72,6 @@ func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
start_sensitivity = SENSITIVITY
#Set up gun variables
var instance_gun = level_control.gun_1.instantiate()
instance_gun.global_transform.origin = weapon_spawner.position
gun = instance_gun
def_weapon_holder_pos = weapon_holder.position
ammo = gun.max_ammo
ammo_reserve = gun.max_ammo * gun.start_mags
bullet_damage = gun.bullet_damage
gun_fire_pitch_starting = gun.audio_fire.pitch_scale
weapon_holder.add_child(instance_gun)
#turn off audio if unchecked in player
if AUDIO == false:
@@ -269,8 +258,8 @@ func weapon_tilt(input_x, delta):
func weapon_sway(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, 1 * delta)
weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, mouse_input.x * weapon_rotation_amount, 1 * 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)
#crosshair.position.x = lerp(crosshair.position.x, mouse_input.x * 100, 2 * delta)