So recently I switched over to C# to help get a better grasp on class design and object oriented programming in general. So I thought the best way to learn it was to just right in and start programming what I want to program which is games. Specifically 2D indie style games.
So I have created a few games (Mainly Puzzle Games) and now I feel like a challenge. So I am starting to lay down the framework for a 2D Vertical Scrolling Space Shooter. Now I know C# is a bit different then C++, but not to much so was hoping you guys could help me with my design.
Mainly what I am stuck on right now is how to use inheritance correctly. Lets take a the ships, and guns for example
What I am thinking is making one class to hold all the ships (The ships will all be the same except for cosmetic looks, so its just a simple matter of changing a few things I think). I would then make child classes for each weapon available (probably about 5-6 in the beginning). And then make a child class for each weapon that supports multiple bullets or powerups.
Now I was going to have the ship class hold all the general information about its health, shields, design ect.
The weapons class's will hold the information for that weapon like how many ammunition it can hold, its reload time, the base damage, rate of fire ect.
Then for the bullets and powerups class's will be in charge of the different powerups for that weapon. Like adding additional damage of a certain type, changing the rate of fire, armor piercing ect.
Now this seems like to many classes for what they are doing. Is this the wrong way to go about it or do I have the right idea?
I don't have very much experience with big projects and class design in general (maybe 2 months) so would love some suggestions or some tips.
The basic approach seems ok. The bigger challenge you face is how to communicate with in these class. Very important factors of design will be decide on
1. What all features / interfaces will be base class will provide.
2. What all features can the derived classes will be able to extent.