New to gamedev. So I’m trying to make an enemy system like in terraria, e.g. a universal Enemy class, within it are enemy AIs, within those are individual enemies.
I got everything working fine, I can change variables on individual enemies that are exported from their parent and grandparent, but the enemies don’t have the Area2D hitbox and hurtbox that their grandparent has.
I have an Enemy node which also creates the class EnemyClass, and within it are two Area2D nodes, each with a CollisionShape2D. Within Enemy is also AI_Fighter, which extends EnemyClass, and within that are my individual enemies, which extend AI_Fighter.
I export hitboxradius and hurtboxarea in Enemy, and in each of the Area2D I set the radius & area of their CollisionShape2D to hitboxradius and hurtboxarea. I can change the values of hitboxradius and hurtboxarea in each individual enemy, but they just dont spawn with either of the collision boxes.
Can I make the enemies inherit the Area2D from the main enemy node? Am I doing something wrong? Is there a better way to do this? Any help is appreciated, thanks for reading.
So making individual enemies direct children of the base enemy scene will make them inherit the Area2D? But then how do I handle the AIs? I don’t suppose i can attach both the individual enemy script and the AI script to a node?