fixed revolver setup so that it only populates owned casings

This commit is contained in:
Derek
2025-03-27 08:33:20 -05:00
parent 5eec7838d8
commit 909f84e6dd
5 changed files with 383 additions and 326 deletions

View File

@@ -57,6 +57,8 @@ func _ready():
cycle_count_start = 3
cycle_count = cycle_count_start
ready_revolver_casings()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
@@ -170,6 +172,15 @@ func spawn_casing():
instance_casing.player_velocity = player.velocity * transform.basis
get_tree().get_root().add_child(instance_casing)
func ready_revolver_casings():
if casing_array != []:
#hide all casings
for i in casing_array:
i.visible = false
#add back ones in gun
for i in range(GameGlobals.gun_ammo[weapon_info.gun_name]):
casing_array[i].visible = true
func spawn_revolver_casings():
if casing_array.size() > 0:
var ammo_needed = weapon_info.max_ammo - GameGlobals.gun_ammo[weapon_info.gun_name]