Learn HaxeFlixel from Scratch (pt. 2): Running the Latest Dev Code

Apparently HaxeFlixel is in the midst of some major rewriting.  If you simply install it using haxelib install haxeflixel, you get the latest tagged release, 2.0.0-alpha.3.  However, the various demos actually depend on the latest dev code to run.  I like to learn from demos and couldn’t handle being left in the dark, so here’s what I did to start running from “dev”, the latest versions of the code.

First, I uninstalled whatever HaxeFlixel related libraries I already had.  At the time, they were flixel and flixel-addons.  You can find yours by typing haxelib list from the command line and then haxelib remove <library> for each HaxeFlixel related library you find.

Second, I went to GitHub and forked the projects I wanted to download.  I did this so I could actually install the dev versions of the libraries from my own repositories.  This will make it easier for me to contribute back, because I’ll be able to make and test my changes locally before pushing them to my GitHub repository and submitting the changes to the main projects as pull requests.

For now, I just went with flixel and flixel-tools, and I recommend you do the same. Flixel Tools contains the command line interface tools that were previously available in the main Flixel library.  You’ll need them to create a new template for a project or convert a HaxeFlixel 2.0.0-alpha.3 project to run on dev.

Next, I installed the libraries from my Git repositories using haxelib git <library> <URL> <branch>. Run this once per library, substituting the library name (flixel or flixel-tools), the Git repository URL (copied from the GitHub page), and dev as the branch. Note that it’s perfectly fine to install from the main repositories instead of your own forks.  If you do use a fork, you’ll be responsible for pulling in changes to your forks from the main repositories before running haxelib upgrade to update your local copies to the latest dev code.

Finally, I wanted to create and test a new project from a template using the flixel-tools command line interface. First you have to instruct flixel-tools to download the template and demo files using haxelib run flixel-tools download. Then you create a new directory for the project, switch to that directory, and execute haxelib run flixel-tools template -n <name> -w <width> -h <height>.

To test this, you should be using openfl, a separate Haxe library. If you don’t have this already, there are download instructions using haxelib on the OpenFL getting started page.  Once it’s installed and setup, you can test your new project with openfl test <target>.  I’m developing on OS X, so I use “mac -neko” as the target, though I don’t think there’s a difference if you just target “neko”.

Now that I’m all setup, I’m eager to continue learning both the language and the library. Not content to just use without giving back, I’ve already submitted my first pull request to the project to rename a couple misspelled variables. Onward!

About these ads

~ by roguewombat on August 3, 2013.

5 Responses to “Learn HaxeFlixel from Scratch (pt. 2): Running the Latest Dev Code”

  1. I haven’t used Flixel myself but I’ve heard good things.

    Have you considered just using Haxe with OpenFL? It provides A LOT of functionality that you need up front. You learn more by implementing the things that Flixel would normally take care of and you have more control over development.

    • I’ve definitely considered it. I’ll probably use HaxeFlixel for my first project while I learn the language and sniff out the particulars of cross-platform development, but I do think I’d like to go native, too. Particularly, I think I’d like to pursue an engine where mobiles / objects are still ultimately EventDispatcher descendants. Flixel uses its own FlxSprite class descending from a generic FlxBasic object that does not support event listeners, which I can only assume was done for performance reasons, but I’m not entirely sure.

  2. Nice article, would love to see more of these! :)

    One little thing, you shouldn’t need to specify a branch at all using the haxelib git command, as the dev branch is usually the default branch. Actually, some repos like flixel-demos or flixel-templates only have a master branch right now!

    • Cool, thanks for the tip. Will remember that if I fork those separately; for now I just took what haxelib run flixel-tools download got me. :)

      • Oh, yeah, that’s a handy command. Just runs haxelib git on flixel-demos and flixel-templates basically.

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

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: