I’ve recently started digging around inside the Flixel libaries written by Adam Atomic. I’m quite impressed so far with its usefulness and simplicity. There are only a dozen or so actionscript files, and most are pretty straightforward.

A few of his classes are just extended from normal actionscript objects with a bit of added functionality. The FlxArray for example is just an AS3 Array with a few functions that may be useful in a game. For example, the “getNonexist” function returns the first object that doesn’t already exist. This would work well for spawning enemies from a pool. There’s also no reason you can’t just use a normal Array instead of a FlxArray if you prefer.
A few of my favorite of Adam’s Flixel classes are FlxSprite, FlxTilemap, and FlxEmitter. These are the classes that really made me say “Wow, these just saved me a lot of time.” Sure, I could write a particle system… but Adam did that for me.
FlxSprite is just like a MovieClip, but it is fine-tuned for games. It automatically updates and moves depending on its velocity. If you want to add an animation, simply call the “addAnimation” function and specify general animation information. It’s very intuitive.
FlxTilemap is a little more complicated, but still easy as pie to use without a lot of confusion. It simply reads a .txt file’s integer values and places tiles from your tile bitmap in the coresponding places on your screen. It’s a fairly standard tilemap, but now you don’t have to write your own.
FlxEmitter is a particle emitter. It has all of your standard 2D particle functionality– velocity, gravity, rotation– you name it. It will even cut up a sprite sheet for you, adding a nice variety of flying particle types. This was another one I found highly intuitive, and I had particles blowing up all over the screen in no time.
I certainly have my gripes, but overall for me Flixel’s benefits have greatly outweighed its pitfalls thus far. One mild annoyance is the input. Adam handles a small handful of keystrokes, and if you’d like to take in more key input you’ll need to edit two of his library files quite a bit (FlxGame.as, FlxG.as). I’m sure he has a reason for this, but it’s not outright apparent to me. Handle my own key input ?!? See, Flixel is already spoiling me.
I wouldn’t say Flixel is for absolute beginners in Actionscript, but you don’t need to be a wizard to use it. My advice– write a few simple Flash games or demos from scratch before tackling Flixel. It’s important to know how things work under the hood, or it will come back to bite you later. Now, time to go flixel around some more. Peace
*Image from Canabalt, an awesome game from Adam Atomic.

subscribe to comments RSS
There are no comments for this post