I think you should start over with the project. Don't get me wrong. It is just too messy now. You have 2 bases and marines moving between them. For those 3 things you create 5-6 classes and almost each of them inherits from somewhere. And most of the inheritance does not make sense. Like for example why does the Base class inherit from KeyedSequence?
Put all of your classes in separate header files. And make the definitions in a corresponding .cpp files.
this ways it is much more easy for us and for you too to follow on your code. Doing this now will save you a lot of headache later when you have much more classes, methods, logic, code. I can see that you try to use everything chili is showing in his videos but that's not always necessary. You have to keep stuff as simple as possible.
Just a couple of examples. I like your design of Unit class and the Marine inheriting from it. But why pass the arguments needed by the SurfaceSequence in the Units constructor instead of directly passing it a surfacesequence or a pointer to one? Thats one of the reasons why you create classes and construct object of these classes.
Base and EnemyBase are actually the same thing. Make a class Base and pass it in the constructor an KeyedSurface object and the values for x, y, BaseHP and BaseDamage. Something like
Code: Select all
// create the needed surfaces
KeyedSurface goodBaseKeyedSurface(std::wstring(L"base.bmp"), D3DCOLOR_XRGB(0, 0, 0));
KeyedSurface badBaseKeyedSurface(std::wstring(L"enemybase.bmp"), D3DCOLOR_XRGB(0, 0, 0));
// pass them to the constructors of base and enemybase
Base goodBase(goodBaseKeyedSurface, 15, 350, 100, 1);
Base badBase(badBaseKeyedSurface, 1200, 325, 100, 1);
And then the array of marines. To me it makes much more sense that the Base is going to have the array of marines than create them in the Marine class itself. So add an array of Marine objects in the Base class. And let the base object control them.
As already mentioned. Im trying to be constructive in my critics and not trying to insult you in any way.
greets