Hello! This is David Grace, aka ChainedLupine. And I’m here with another freshly brewed Alpha Blend blog post.
I use Adam Atomic’s excellent lightweight 2D Flash game library called Flixel. But this article is not a tutorial about how to use Flixel or write games in Flixel; There are plenty of pre-existing blogs which do an excellent job of teaching the basics.
My goal for these series of articles will be to teach more advanced Flixel concepts. Not all of these concepts will be specific to just Flixel, so you might get use out of my tutorial even if you are using something like Flashpunk or an entirely different platform.
While I was working on several projects utilizing Adobe’s Flex SDK for Flash, I found myself growing wistful for the days of C-style macros and defines. In other words, a pre-processor. Why?
Every project usually hits a point where your build diverges as you factor in different levels of support or options. In other words, you want multiple builds for different runtime options. For example, let’s consider the simplest option of having two builds: a debug and a release version. The debug version could be anything from your normal program plus a smattering of simple trace log checkpoint to an entire debug sub-system which handles various testing scenarios. While it isn’t harmless to leave such things lying around in a final build, there are times when you might want to strip them out. You don’t want this code in the release version because it would allow cheating (since I am talking about game development) or you are trying to cut down the overall size of your binaries by excluding unused features.
Let’s wrap it up with an even more concrete example: My last game had an extensive debugging GUI that I wrote for testing level changes.
A screenshot of the debug UI for Dit Dah's game Legend of Kalevala.
I’ve been quite pleased with Legend of Kalevala. It is my first major Flash game after a very lengthy lapse of working on games. (My last full-sized game was retro-styled shmup, released back in 2006.) While it’s not the largest project I have worked on, it has turned out to be the most successful.