Added fire mode select on gun script

This commit is contained in:
Derek
2024-07-14 20:06:00 -05:00
parent 582e03202a
commit 6fedc3e3c5
18 changed files with 382 additions and 31 deletions

View File

@@ -8,6 +8,8 @@ var mouse_input : Vector2
var rng = RandomNumberGenerator.new()
@export_group("Game Settings")
@export var AUDIO = true
@export_group("Player Movement")
@export var WALK_SPEED = 7.0
@export var SPRINT_SPEED = 15.0
@@ -73,6 +75,10 @@ func _ready():
bullet_damage = gun.bullet_damage
start_sensitivity = SENSITIVITY
gun_fire_pitch_starting = gun.audio_fire.pitch_scale
#turn off audio if unchecked in player
if AUDIO == false:
AudioServer.set_bus_volume_db(0,-80)
func _unhandled_input(event):
if event is InputEventMouseMotion:
@@ -157,11 +163,12 @@ func _physics_process(delta):
if Input.is_action_pressed("inspect") and !gun.anim_player.is_playing():
gun.anim_player.play("inspect")
# Shooting
# Shooting & fire modes
if Input.is_action_pressed("shoot"):
gun.shoot(self,delta)
if Input.is_action_just_released("shoot"):
gun.cycle_count = gun.cycle_count_start
# Gun folding out of the way
if gun_ray.is_colliding() and !gun_ray.get_collider().is_in_group("player"):