I don’t know how to decide when to break things up.
I’m making a color-sorting game that has the following things (simplified):
-
Colored boxes (can be moved around)
-
A box dispenser (boxes exit from here at regular intervals and fall to the ground)
-
Slots for the boxes (you move the colored boxes into these slots in the correct order to “win”)
-
Layout (where the slots go on the screen)
-
Solution (the logic that figures out what colors you get and what order they should be to “win”)
-
Demon (an enemy that knocks down the boxes you’ve placed)
-
Score
-
Timer
-
Settings
Right now I have a separate object and script for each of these. The boxes also have a “draggable” script that allows them to be moved and either dropped in the air or placed into a slot. Game flow (start, reset) is currently inside the “Solution” script.
I’m trying to do this right by “separating my concerns.” But it feels wrong and needlessly complicated for such a simple game. I wonder if I should basically just lump almost all the game logic into one script, with only minimal communication between the boxes and that script. The boxes would have a movement script, and then every time the player lifts up the mouse button, the box would tell Game its new position—and that would be about it.
What’s the right thing to do? Keep all this separate, and even make a new GameFlow object? Or combine the base logic into one Game object until there’s some reason not to?