Friday, July 24, 2009

Experimenting with haXe

So, I found on the web this nice language that can compile to flash/javascript/php and other bytecodes (even to pure binary) and I decided to give it a try.

And, also, some time ago I started to wonder if I could make a Facebook app (a game).
I started to think to something easy to make and funny to play and then a little flash game on a site with some simple tutorials reminded me of a stupid game I wrote in C at school using only OpenGL's rectangle and triangle.

I spent something like 3 hours trying to code a GameMaker-like engine in flash, but I wasn't able to figure out how the flash drawing system works.
Tired, I pointed my browser to Google and found this nice tutorial on making a 2D game with haXe. Its approach to bitmap blitting is odd: it creates a BitmapData object for the screen, then it creates a Bitmap from it and adds it to the root (flash.Lib.current).

I adapted some of the tutorial code to my engine and now I have some rectangle moving on the screen :). The next step will be to add support for animating sprite and then I can start the funny part: programming the gameplay.

Here is the demo (only 6Kb, you should understand why it is so small xD):