Sunday, May 4, 2008

Spiking mxmlc

First, the ultimate retro project repository has just been updated and now contains a playable version of Classic Monster Hunt. I still haven't wrote the instructions and I still want to clean up the code a bit but it is fully playable at this point. That being said, I didn't spend that much time today working on it but instead spent my time playing with mxmlc.

For those of you who don't know what mxmlc is, it is the command line compiler that is included with the freely available Flex 3 SDK. While it is certainly much nicer to use Flash CS3 or FlexBuilder to create swf files, both those options cost money and since I want my open source releases to be usable without the requirement of expensive tools I wanted to see how much work it would be to create a game without the expensive tools. I have taken some baby steps by trying to keep my source code outside of my flash file. With 13 Spikes, however, I am creating the entire game using the command line compiler and a text editor. For those who are curious, I am using jEdit for my editor.

Using the command line compiler and debugger is not that difficult, so anybody who wants to create flash applications but don't have any money certainly could handle it. The thing that is not made as clear as it should be is the fact that you do not need to create a flex program to use mxmlc but can instead write your program entirely in ActionScript 3. In fact, if you do not need the flex library you might be better off without using mxml as there is a bit of an overhead for the flex libraries.

I can't say that my first few hours of only using a text editor and command line tools was not as productive as it should have been as I had a lot of problems getting my Spike sprite class to work properly. This was my first attempt at overriding the Sprite class as I normally use the MovieClip class but sprites are suppose to be much more efficient. My problem was that I was trying to set the width and height of the sprite. Why that would stop the sprite from drawing itself is beyond me, but once I removed the code that set the width and height of the sprite it started working fine. It appears that width and height are internally used, as once the sprite was drawing, printing out the sprites width and height came back with the size of the object that I was drawing.

No comments: