Another alternative is to show/hide the weapons instead of creating and destroying them. That way you can load all of them at the same time instead of hitting the hard drive during gameplay. This could be useful if you are intending for the player to switch weapons frequently or for the number of weapons to be finite.
That is a great idea. This would imply preloading everything into some global state/handler and calling some _get_weapon_from_global() as needed?
wndr | 2020-07-22 14:52
You might be able to simplify it even more by having all of the weapons as children of the same node, and call hide() on the current weapon before calling show() on the next one.
Later, if you want to, you could have it play an animation before/after those function calls to represent equipping the item.
JimArtificer | 2020-07-22 23:16
Cool, I will implement some variations of these things and see what works best. Thanks for the feedback.