Creating Enemies

Godot Version

4.4.1

Question

I have to mention I am quite new to Godot and I am still learning more and more about the engine and language as well.
I have a small question about creating Enemies, more on the way to create them. It may be the type of question that doesnt have a wrong answer but i would like to hear your thoughts and experiences on how would you do it.
For example one of the ways I thought of is to create a EnemyBase script which is a class and I will create new Nodes and extend it to those while being able to code their own special functionalities.

I also saw that I can create the EnemyBase Scene and script and just create an inherited scene form there. I noticed that there were some negative comments on this solution but

And the last one was to create a EnemyBase script which will be a resource and create the enemies in there with their main stats added to the editor through @export.

When creating these for a Tower Defense where a huge number of the same enemy type would be spawned does it make a difference in the way we go on about creating the code? What would the main differences or issues that would come from using these ways to create the enemies?

One way is to use nodes as components (e.g. RangeAttackBehaviour, ChasePlayerBehavior, LifeComponent) and export some of their parameters (e.g. max health, movement speed, attack range, etc).

Then you create different type of enemies by combining components and setting their parameters.

For instance, you could have 3 enemies with the same components, but different parameters (e.g. green, yellow and red skins, with low, medium, high max health); or enemies with different components (e.g. an enemy that attacks with range and does not move, or an enemy that attacks with a meelee weapon and chase the player).

You will probably hit a wall when trying combining behaviours together, and it will probably mean that is it is time to look at state machines or behavior tree to combine these behaviors.

There are a lot of amazing resources on this website to learn these things:

You can also have a look at this starter kit I have made, which is open source, and where I used state machine for the main character and behaviour trees for the enemies: