DevLog: Space Bomber #4 - Menu improvements, UI refactoring, Cheat Codes!

Code refactoring extravaganza


Most games should have a menu and Space Bomber is definitely one of them. So far, the starting screen was all it had with two ugly prompts plastered on top of a screenshot of an early version of the game. This changes with today's updated which brings a proper menu system. As far as the user side is concerned it's your typical UI with several options stacked on top of each other through which one can navigate using the arrow keys. The animated bombs on both sides of the text indicate the currently selected element.




Things got much messier in the code itself, though. Until now I had one class operating the entire UI - the help screen, the start screen, as well as the game UI on top of the screen when the game is running. This is not a maintainable code structure so I dug deep into it and separated out the GlobalUIController which manages many smaller controllers responsible for each view. This allows me to easily add new screens and shuffle them around using the global controller. It also feels more like the way it should have been written from the start but that's what such projects are for. Another screen that was added because of this refactoring is the splash screen which now features the animation of the hero of the game. Again, nothing fancy but it allowed me to test the global/local UI controller structure and it was very easy to take advantage of it.




The leaderboards, which previously were a top 3 listing on the game over screen, now have their own place in one of the menu entries and can accommodate up to seven scores. This number is purely enforced by the UI as more wouldn't fit on the screen. However, the code allows to have as many entries as one wishes so whenever the UI changes and more/less space is available, the scores will be added/removed as needed.


Cheat codes


The final improvement in this update is the cheat code system. I described how I did it in code elsewhere so feel free to read the post and use it in your own game - it's as universal as can be, I hope. Reading through the code also lets you know which cheat codes are currently available. Be aware that using them might or might not be penalized at the end of the game ;)




That's it for now. Thank you for reading. The next update should bring more gameplay changes as I finally want to start work on level design logic so that levels are no longer (or not only) procedurally generated. Right now feel free to explore what will hopefully become Endless Mode in the future.