Skip to content
Tags

,

Getting started with Haxe

March 11, 2014

First blog post for a while! Unfortunately I badly broke a toe three months ago (rushed to answer the door in socks, hit a doorframe at the wrong angle and *crack*, middle toe snapped off at an angle over the top of the one next to it) and effectively had to learn to walk again after it took ages to heal, so the physio there has been taking up a lot of time. I’m back to something resembling a recovery now and have dived straight back into development.

Recently I’ve noticed a trend towards multi-platform development, releasing for flash, mobile and html5 working out far better than simply releasing for flash alone (I know others will disagree with me on this point, but in my personal experience there’s simply not much money in flash anymore).

So, with that in mind, I started looking for a solution, and an immediate one that cropped up was Haxe and OpenFL. I dived into the documentation and got stuck right in, copy+pasting some existing as3 code I had straight into haxe files just to see what would break and what would work and fixing what was broken. About as haphazard an approach to porting as you can get, but with the large similarities between as3 and haxe, I actually got on okay with it after some initial confusion (it’s a steep but quick learning curve to get used to the command line builds and syntax changes while figuring out what the limitations are).

This is a big change for me, not using the flash IDE, not using vector graphics or the easy animation workflow that it offers. Everything has to be manually coded, even animation has to be manually advanced frame-by-frame via code (as far as I can tell, there isn’t a library that offers this, only tweens?) and simple stuff like placing a clickable button on the screen is a little more involved than simply throwing a flash simplebutton on the stage.

The end result of a day’s head-scratching? Not bad actually, I was able to re-create my screen-handling framework successfully (without transitions for now, but I know how to add them back in) and feel like I have a good grasp of the syntax and what I can and can’t do. Next step is trying to figure out animation and other basic stuff… the docs explain how to use actuate to tween stuff, but frame-by-frame animation seems to be totally undocumented and I’m really hoping that doesn’t mean I’m stuck with bitmapdata.draw() as my only option for animating anything. That’s going to be tricky if so.

Here’s a link to what I managed to cobble together, fairly unimpressive looking as an example, but the code behind it is very solid, allowing me to switch screens and have them clean up their eventlisteners and choose a transition for them properly all with a single line of code:

http://www.newgrounds.com/dump/item/2f1c32e21ca21db0d55007223deb72a9

Lots of work ahead, but I’m hoping it’ll be worth it. It is certainly really fun to test a project and have an instant html5/ android game in front of me despite the fact that I know precisely nothing about js or C++. The end result I’m hoping for is to be able to make three times as much as I normally would from just making a flash game alone and not touching the other stuff and hopefully get some sort of reasonable regular income going. I plan to get a new game together over the next month or two and take it from there. Exciting times! 🙂

Advertisements

From → Game Development

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: