Im writing a classic arcade clone game, the one with the plane you control and shoot all the other planes, while trying to dodge enemy fire (and ships as well). Featuring spread fire power ups, bombs etc. etc. I think it was like aero asssult or something like that.
Any way I've come to a fork in the road on two possible options for class (unit) structure.
So far I have the following:
CUNIT // top level abstraction for every unit in the game
-base vars all units must have
CSHIP : public CUNIT // base air/space vehicle unit
-variables and functions related to air/space vehicles
CXUAF : public CSHIP // this is player one ship
-variables for player one
Basicly my two choices are this:
-For every ship type i can create a class that inherits from CSHIP. All i have to define function wise is movement function, and initiation.
-Make one general ship class, and for every ship type create a new class and give it a pointer to a moveFunc() and Init() function.
So i can make a bunch of classes with only moveFunc() and Init() that differs them, Or i can make a bunch of moveFunc() and Init()'s and pass them as pointer functions when ever i make a ship type. This seems like it might be less code, and a better rout as two functions isn't usualy a good reason to make lots of classes, but Im inclined to go with more classes option. Not sure why, a gut feeling I guess.
Any suggestions on which way i should go?
btw, the player one ship class is called CXUAF, as the name of my clone is xUA Fighter, or (x)prototype (U)pgradable (A)ssualt Fighter :P