Quote:Original post by karpatzioQuote:Original post by Captain PQuote:Original post by shuwo
Now I've got a new problem. Where do I put all my objects? For example, if I have a lot of game objects (sprites) like Enemy, Player, Fish, etc, where do I "create" them?
I usually make a Game class of some sort and put them there. It may be useful for certain game objects to have a reference back to the Game object - this would allow your characters to create Bullet objects and add them to the Game, or to ask the Game which other characters are nearby.
No need to use globals here, though. If some code needs to know about the Game object, just pass it a reference or pointer to the Game object.
This would create unnecessary dependencies, game logic should be handled by other classes. For example create a sprite collection class that would handle collisions, movement and creation/destruction instead!
Sooo, do you have any other suggestions?