Hi everyone!
I have this “Ennemies” class with variables and functions that are commons to every ennemy in my game. Then, each ennemy has its own class that “extends Ennemies”. In a specific class, I have an Array<Ennemies>
that stock every ennemy in the current map.
The problem I’m facing right now is that from the “Array”, I need to access
public function hit(damage:Int):Void {}
that every ennemy has, but each ennemy has different code lines in that function.
Right now, what I’m doing is that the “Ennemies” class has an empty function that I override in each ennemy child.
It works very well, but I was wondering if this is a good approach.
Thanks!