Hello, this is quite a long one but I am pretty stuck.
I am making a tank game. The point of the game is to destroy waves of AI tanks, which will all have random tiers of "modules". Each tank has 5 modules (belt, armor, barrel, shell, engine) and each module has tiers, for example a better tier engine will make it go faster.
The player will spawn, and it will be just like every other tank. Your tank will start out with only the first tier of every module, and all other tanks will also have only the first tier. The moment you buy a better tier module (for example better armor), all new enemy tanks will have a chance to spawn with that better armor as well.
The problem is, how do I do this? Currently, I have a scene for every single tier of every module, and each one has a script with a variable (for example armor 3 has the variable health = 300).
(each tier is the same thing but with a different sprite and variable)
I was thinking that you can simply have a tank scene with the scripts for AI and health and everything, but it will randomly choose a module scene to load. The problem is, I feel like the whole thing is super messy. If I load a Armor4 module, then to access the health amount I can't just read the variable from $Armor.health, I would have to add a 4 to it because of the name of the scene ($Armor4.health). Firstly, I don't know how to add that 4 there, secondly, doing this each time seems really messy, lastly, it would work terribly with the player, a tank that changes these tiers because you buy them.
This is my attempt at making the enemy tank scene load a random tier. So in the first node of the scene which controls the entire game I specified the current tier of the Armor module, and each time a tank scene gets spawned, I want it to randomly choose from 1 to the current best tier. Firstly, it doesn't work, but more importantly, the entire thing just seems... messy. Like I'm doing it the worst way imaginable.
I know it all is badly explained but if you understand my concept, please share with me some ideas of how would you go about making this. If you have any questions, ask me. I'm pretty new to Godot and not a good coder (I'm guessing it's pretty obvious), and I'm really baffled because what I thought was a simple idea to code turned into a nightmare.