I'm developing a game for Android in Java. I would like to know how a good Enemy class architecture could be implemented.
I've created an abstract class called Enemy. It stores common properties like Health and Animation data. It has methods like LoadContent, Update and Draw.
I want to inherit this class and implement different enemy classes. I want to be able to store all my active enemies in some sort of collection. Then in my Update function of my game loop, I'll do something like:
for each Enemy in Enemies
{
Enemy.Update()
}
And the Update method of the correct child class would be called.
How can this be achieved?
Entity
, which may be controlled by an AI or the player. Without knowing what you're making, there is no way to know how to properly answer your question. \$\endgroup\$