Tag Info

New answers tagged

2

Personally, I like the idea of stages, scenes and actors a lot, even for small projects. That way, you can always add new classes and just plop them in, and they act as individual objects that can be thought of as such. By creating classes for all of your rendered items like so: Stage (MainMenu) Scene (MenuNavigator) Actor (MenuItem) Actor (MenuItem) ...


6

Should I be splitting these functions out into dedicated classes somehow as to reduce the complexity of the god class? Yes, that's a good idea. A good place to start might be to break up your single monolithic class into smaller classes with related functionality. Managing levels seems to be a common theme, so maybe creating a LevelManager class that ...


3

You should try drawing it out on a sheet of paper or in some kind of UML mocking program. It will take a few iterations to sort out what seems to model most accurately which roles should be assigned to which classes. Given your example though, you have a few things that are completely unrelated in the same class: startNewGame(); showAd(); prepareLevel(); ...


3

When the game is simple, such a class should not be that large. When the game progresses to large, you should split it up in the way that feels the most natural to you. I tend to end up with a simple finite state machine for the application state, then run a kernel (i.e updating prioritized tasks) in each state. These tasks often live in a 'scene' so I ...



Top 50 recent answers are included