Godot Version
4.2.2
Question
I am trying to make a Tower Defense game and since I am quite new to programming I hit a small wall. It’s concerning the Enemies in the game.
Since it’s a tower defense game I want to have multiple types of enemies with different abilities ( different speed, different armor, spawn mobs on kill…)
I have been looking around online for some ideas on how to implement this and there were some interesting topics. With my current knowledge I understood the functioning of two ways I could implement this.
The first one is to create different scenes for every enemy and then instantiate it through the spawner somehow, which I think would add more lines of code but it would be more natural like that. I looked around online and saw a few projects that only had one enemy script. Is there a way that I haven’t thought off to use one script for all of the enemies but for them to spawn with different attributes and sprites? My biggest issue with this would be that I would have to spawn them through a spawner so the inspector wouldn’t be of much help except for resources maybe?
And the second approach to make it more modular that I found on the forum is Custom Resources and arrays that You can edit through the editor. Now I tried it out with the second one to try and learn how they function and managed to get the arrays working at least but the issue was with spawning. I made a basic Enemy Script and created 2 enemy resources but I didn’t know how to spawn those without placing them myself. The question I have is how do you spawn a enemy scene through Instantiate and when it’s spawned to get the properties of the resource. Also I read that if I spawn the same enemy type resource they share the values.
My question is mostly of the type in which way should I tackle the Enemies in the game. What would be the most beneficial way to introduce the Enemies in the game without more lines of code that would make it slower in turn.