Time constraints reign akimbo for today and the next couple of days for presumably obvious reasons. As such I have finished most of what I intended today but I have simply run out of time to find and squash one last problem with it. Hopefully I can hit that tomorrow, where I can only guarantee that I’m going to get at least an hour of coding in.
The changes today relate to modifying the rest of the existing logic to use the state machine, which went pretty well.
The logic modified was for the removal of the gray bricks from the maze when all balls are played, and for finding and dropping all of the remaining balls, one at a time. In both cases this primarily involved removing the boolean sentinel values and all associated code from the Maze entity and then adding in similar replacement code (and event calls) to the Game scene.
For example, the maze used to detect on every update if all balls were gone and, if so, vanish away all gray bricks. Now it does no such thing and instead the main game state transitions to a new state when it detects that neither player has a move left to play. In this state it keeps telling one gray brick to vanish itself every few update loops until it has told them all to.
Similarly, when all of the gray bricks are gone, we move into the final ball drop state, wherein we just select a ball to drop. That transitions to the ball dropping state, which comes back to the final ball drop state when it’s done. That state will switch to game over when all balls are pushed.
Currently there is a bug where a final dropping ball will not properly vanish if it starts out blocked. My first suspicions are for some sort of timing error or a bit of a logic hole caused by the control booleans going away. Unfortunately I’ve run out of time for today to dig into it. I shall endeavour to repair that problem tomorrow.