Installation
Now that you have a good understanding of what we'll be using, let's start installing what we'll need. Haxe, OpenFL, and HaxeFlixel are all designed to be easy to set up, so this is going to be pretty straightforward.
Installing Haxe
Go to http://haxe.org/download/ and download the installer for your operating system. Run the installer; be sure to install both Haxe and Neko when given the option.
This will install the Haxe framework, which includes Haxelib, a useful tool for installing Haxe frameworks and libraries. You will typically use this to install all Haxe libraries, which will make the installation of OpenFL and HaxeFlixel incredibly straightforward.
OpenFL
To install OpenFL, open a command window (or terminal on OS X and Linux). Next, run the following commands:
haxelib install openfl haxelib -notimeout run openfl setup
These two commands will download, install, and set up the OpenFL framework and all of the libraries it needs. The notimeout
flag prevents the setup from timing out before it completes. This is useful because the OpenFL setup will download quite a number of files, and it can time out if your internet connection is a little slow.
When asked if you want to install OpenFL, press Y. On Mac and Linux, you may be asked to enter your password. After this, OpenFL will be installed and you'll be good to go!
Setting up an IDE
Before installing HaxeFlixel, it's important to install a code-editing tool, because you will be prompted to choose one during the HaxeFlixel setup. Your operating system will be a factor in choosing the best tool for you.
Windows users are able to use FlashDevelop, which is a fully featured IDE that will work with Haxe out of the box. The best part of using FlashDevelop is that you can debug your games by targeting Flash and using the Flash debug player. This will allow you to put in breakpoints, see console logs, and inspect variables. You can download the latest version by going to http://flashdevelop.org. If you are using Windows, I highly recommend using it.
For Mac and Linux users, the best tool available is Sublime Text 2. It's a solid code-editing tool, though it lacks support for breakpoints, console logs, and variable inspection. You can download the latest version by going to http://sublimetext.com. You can also use Sublime Text on Windows if you prefer it.
To make Sublime Text a more effective Haxe editing tool, you should install the Haxe plugin. The easiest way to install it is using package control, which you can install using the steps located at https://packagecontrol.io/installation#st2.
After installing package control, use Ctrl + Shift + P (Windows or Linux) or cmd + Shift + P (Mac) to bring up the command palette. Start typing in package
and then navigate down to Install Package. You will then see a list of available packages to install. Type in Haxe
to find the package named Haxe. Install that and you're good to go!
Installing HaxeFlixel
To install HaxeFlixel, run these commands:
haxelib install flixel haxelib install flixel-tools haxelib run flixel-tools setup
You will then be prompted several times during the setup. Here's what you should do:
- When a command appears asking if you want to set up Flixel, press Y.
- When asked if you would like to download
flixel-demos
andflixel-templates
, press Y. - When prompted to enter an author name, either type in your name or leave the field blank. It will automatically use that name when creating project templates.
- When asked to choose your default IDE, enter the number corresponding to your development tool of choice.
- Choose either Y or N when asked if you want to automatically open created templates and demos with your IDE of choice. This will just immediately open your project in your IDE instead of requiring you to navigate your filesystem.
- On Macs, if you chose to have templates and demos automatically open, you will be asked whether or not you want to run a
symlink
command. Press Y.
If you ever need to change these settings, you can run the Flixel tools setup command again.