added the ability to spawn in with only one gun

This commit is contained in:
Derek
2024-07-18 08:20:52 -05:00
parent 6fef7d2a6c
commit dea6c0bfd9
3 changed files with 13 additions and 12 deletions

View File

@@ -6,21 +6,25 @@ extends Node3D
@export var gun_1 : Resource
@export var gun_2 : Resource
var held_guns = []
var ammo_current = [0,0]
var ammo_reserve = [0,0]
var ammo_current = [0]
var ammo_reserve = [0]
var guns_dict = {}
var current_gun_index
# Called when the node enters the scene tree for the first time.
func _ready():
#Set up starting guns and ammo
held_guns = [gun_1,gun_2]
held_guns = [gun_1]
var instance_gun = held_guns[0].instantiate()
var instance_gun_2 = held_guns[1].instantiate()
ammo_current[1] = instance_gun_2.max_ammo
ammo_reserve[1] = instance_gun_2.max_ammo * instance_gun_2.start_mags
ammo_current[0] = instance_gun.max_ammo
ammo_reserve[0] = instance_gun.max_ammo * instance_gun.start_mags
if gun_2 != null:
held_guns.append(gun_2)
var instance_gun_2 = held_guns[1].instantiate()
ammo_current.append(instance_gun_2.max_ammo)
ammo_reserve.append(instance_gun_2.max_ammo * instance_gun_2.start_mags)
# Spawn first gun
current_gun_index = 0
gun_spawn(0)