From b2c60a56e3e15db89e7477d212502d69c84d9322 Mon Sep 17 00:00:00 2001 From: David Briscoe Date: Sun, 15 Oct 2023 00:04:49 -0700 Subject: [PATCH] Always have a valid weapon Fix crash when you're shooting when you die or when you start the game. Since weapon is nil (waiting for anim to finish before assigning it), the game crashes trying on Audio.play(weapon.sound_shoot). --- objects/player.gd | 1 + 1 file changed, 1 insertion(+) diff --git a/objects/player.gd b/objects/player.gd index a41b635..12f58f0 100644 --- a/objects/player.gd +++ b/objects/player.gd @@ -51,6 +51,7 @@ func _ready(): Input.mouse_mode = Input.MOUSE_MODE_CAPTURED rotation_delta = Vector2.ZERO + weapon = weapons[weapon_index] # weapon must never be nil initiate_change_weapon(weapon_index)