Godot Version
4.5.1
Question
Hello! I’m making a space shooter (shmup) with a shop for new weapons and upgrades. How do I do that? My problem is: 1. Making a shop that can read/write values of weapons. Like if they’re purchased, equipped, or upgraded. 2. Using that weapon in the game with the upgrades.
This is what I’m thinking so far:
-Create an autoload node with every weapon in the game. The weapon will have the class PlayerWeapon. It will have some exported variables such as cost, owned, equipped, etc.
-Under each weapon, I’ll add a node with class WeaponSpawner. This will be a Node3D with code that will spawn the bullet.
-Under each weapon, I will have nodes with class WeaponUpgrade. They will also have exported variables like cost.
-Shop menu will run a “for each” loop to cycle through the weapons and add them to a list.
-Run another loop in shop menu to add the upgrades.
-For gameplay, at the beginning of loading the player, make the WeaponSpawner for the selected weapon into a PackedScene.
-The bullet will spawn with the upgrades attached as nodes. Have code in the bullet itself to run through each child and apply the upgrade.
I’m a bit lost because all of this is daunting. Am I on the right track? Is there an easier way?
Should I simplify the whole thing to do an easier system? For example, knee pushups come before real pushups. So if there’s a way to do an easier version of this, I’d rather do that, and try a full implementation on my next game.
I’m also worried about the CPU cost of doing all this - specifically adding nodes under each player bullet to apply upgrades. I try to make my games accessible for as many people as possible, but my last game was a bit too rough on older CPU’s. I’m trying to optimize wherever I can, and this feels like it would be a big calculation for a game with lots of bullets and enemies.
For context, I’ve made several smaller games already with menus, options, cutscenes, etc. I’m still at beginner level but I’m trying to challenge myself. This is the next step in my learning for me, but it feels like climbing a mountain.