Hi. I'm making a shooting game and since my code was getting a bit messy and big I decided to divide it into couple of classes and files. I'm confused of how to correctly split these files and classes up though. As I imagine it without really knowing if that is the best way or not I have one base class called game, this is the class that draws the map, display's all the objects that are not moving and handles stuff like updating graphics for these items (when player loses his live it wipes out a heart etc.)
Next I have a class derived from this base class called Player which handles all the player related stuff, updating his position and drawing him on the screen. I also have another class derived from the base class called enemy which handles the exact same things as in the player class but just with enemies position etc.
Now what I was hoping to do is this
Update map seperately
display player on map but be able to draw him every couple of times per second + bullets etc
do the same thing with enemy
I have created a virtual function for draw but there is a problem. My map covers the whole screen so I can't just pass things in and out of it without having access to the base class map, objects of other classes will of course just create their own map.
What would be the best way to hande this? to seperate these processes but still be able to keep one stable map?
By the way my game map consists of a char array, are vectors better for this?
I'm quite new to game making so I'm also just looking for general advice on how to do things.
best
Doddi