1: A state machine.
Now I can have a menu system where you enter X number of text entities with their x/y locations. These "SelectableEntity" types have 2 images. One for selected; one for unselected. They also have an abstract doAction method. The state machine keeps track of which menu item is selected and handles the up and down key press to change which item is selected. It also catches the enter key and fires off the doAction method of the currently selected choice.
2. Next scene, what a pain.
Because I'm using property change events to fire off timer events and collision events I ran into a lot of interactions which I hadn't thought about when moving to the next scene (level). Now the scene manager knows to unregister the listeners for level X when we move to level Y. I also more correctly clean up the Open AL buffers and sources so I can load the new buffers and sources. Now that I have a generic sound engine it's very easy to load up and play new sounds. I'm using SFXR to create cool 8 bit style sound effects. Finally, the paint command in the game loop was having a concurrent modification error when I was deleting the old entities and entering the new entities for the new scene. That took a little clean up work as well.
3. Build a new level.
Now that the engine and scene manager are becoming more mature I shoudl be able to build new levels more quickly. Here's what I have so far for my proof of concept game Planet Ball.
Title Screen : Press any key to begin (I need to add an exit command and credit screen)
Level 1: Green and Red planets can be controlled to capture the appropriate colored mini planet. Capture your own color gives you +10 points. Capturing the wrong color gives you -5 points. Bouncing off the other player's planet subtracts 2 points from both scores.
Level 2: Same as Level one with different music and your planets are smaller. Also, at random times a small jagged asteroid of a player color will cross the screen. Capture your color gives you +20. Capturing the wrong color subtracts 15 points.
Level 3: Same as level 2 but now I have a slow moving black hole. Touch the black hole and you lose 30 points AND you bounce off at a high speed which can cause all sorts of chaos.
Clean up the random start code for the occasional asteroids.
Clean up the code which determines if the asteroid is fully off the screen.
Make the asteroids spin.
At this point I have to decide how far I want to go with the proof of concept game. My real goal was to learn about the game engine and also to develop a generic 2D game engine which will allow me to write a future game idea. That future game idea needs a scrolling tiled background and some additional collision logic. However, Planet Ball is becoming a fun game. We're even going to have a single elimination Planet Ball competition at work. So I'd like to get at least these three levels completed.
Next goal: Can I create a simple Breakout style game using this engine? If so then my game loop, entity code, scene manager, timer event and collision mapping code would seem to be pretty complete.
Add tiles backdrops and scrolling tiled backdrops.
Add testing code which can jump directly to a particular scene.
Add a debug screen which shows me the collision rectangles (done), Frames per second, skipped frames and memory usage (not done)
Wow, that seems like a lot more coding than I had thought. I'll just keep eating this elephant one bite at a time.