Sign in to follow this  

Creating Enemies

Recommended Posts

Hello All,

Another design question here. I am creating enemies in my JRPG and have come to another sticking point.
Namely, do you create a single "Enemy" class and then instantiate objects of that type, then load the respective properties from say a flat file or database like "Bestiary";
enum EnemyType{
Orc = 1;
Goblin = 2;
Skeleton = 3;
DireWolf = 4;
Zombie = 5
Enemy Orc = new Enemy(EnemyType.Orc);
Enemy Zombie = new Zombie(iEnemyType.Zombie);
Or do you create a different sub-class for each type of enemy, and then hard code the properties for that class?
Or is it just a case of personal preference? 
I hope that all makes sense and thanks for the help.

Share this post

Link to post
Share on other sites

This is a typical problem where composition and data oriented design should be preferred. Reason is that inheritance yields in more maintenance problems due to needlessly deep hierarchies, and design work would be burdening the programmer.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this