Last commit for Devember 2015

This years Devember draws to a close with a couple of last commits, cleaning up the remaining issues in the code base. This has been a great experience in generating content for public consumption and I would do it again in a heartbeat.

Reminder: the project repository is hosted at, with tags for the state of the repository as of the end of each day of Devember.

So what’s different in the code versus yesterday?

Since this is the last day, I just tied up a couple of loose ends. I had an issue in my gitlab issue tracker to close out which was just to finalize a note I made to myself in the code that restarts a level to make sure that all state was being properly reinitialized. I was pretty sure that it was since everthing seemed to work just fine, but better safe than sorry, I always say (just ask my wife).

I was correct, but I did make a minor tweak there regarding the preview of the next capsule to drop. This is implemented by having a second capsule visualized and copying its style to the capsule that the user controls. Previously this meant that at the start of every level (whether a new game or just the next level in a series) the first capsule to drop would be the previous capsule visible in the last level.

Although there’s nothing wrong with that, I went ahead and modified things anyway by making the level restart code generate a new random next  capsule.

The last change was just to clean up the TODO markers I had in my Preloader code involving errors. The original implementation was just a rough grab of some code I have used in the past so I thought I should make it more robust.

Now there is a single handler for images and sounds instead of a separate one for each. The same handler is also used to catch an error event for each type, so that errors are properly detected. We do a little bit of error handling by using data urls to provide a default image (red X) or a default sound (short silence to keep the data URL as short as possible) just so that things will continue to work even if an asset fails to load.

With this, my Devember draws to a close. I plan on doing at least two more blog posts in this series, one talking about the lessons learned (or not) throughout Devember and one to be a companion to anyone that is learning to code that wants to use my Rx code to learn how to make a Dr. Mario clone. That in particular is the sort of thing I would have found invaluable back when I was learning how to program.

I hope everyone has a happy, healthy new year and that Devember has inspired a whole new lot of new aspiring programmers and game developers to take the plunge!