Getting Started

Welcome to getting started with HaxeFlixel. In 5 steps you will compile a "Hello World" project to flash.

If you are totally new to Haxe please go through the basics with the wonderful tutorials by Travis Faas at http://dustytome.net/haxeNmeIntro/intro.html.

 

Step 1. Install Haxe & NME

You can install Haxe & NME with native installers for Mac, Windows, and a bash script for Linux. We recommend you use the installers that are provided by HaxeNME.

Download HaxeNME

 

When installing make sure you leave the defaults ticked to install all of Haxeflixel's dependencies.

 

Joshua Granick has created a Video of install NME from scratch on Linux, Mac and Windows. 

 

 

Step 2. Install HaxeFlixel

The latest stable version HaxeFlixel is available on the official Haxelib system.

Using this tool to install Haxeflixel is a simple terminal command that works the same way on all platforms;

    haxelib install flixel

 

 

Step 3. Create a Hello World Project

To create a Haxeflixel project Haxelib can help us here again.  Make a new directory for your project and change into that new directory. Now you can type the following command to automatically generate all the files HaxeFlixel needs;

    haxelib run flixel new -name "hello_world"

 

Notice all the template files for a new HaxeFlixel Project were automatically created in your folder.

 

 

Step 4. Write the Hello World Project

Inside the MenuState.hx file in the source folder you are going to add a FlxText object which will display the text "Hello World" by adding the following line in the create function;

  add(new FlxText(0,0,100,"Hello World!")); 

 

Your MenuState.hx create function should now look like this;

override public function create():Void
{
  #if !neko
  FlxG.bgColor = 0xff131c1b;
  #else
  FlxG.bgColor = {rgb: 0x131c1b, a: 0xff};
  #end		
  FlxG.mouse.show();

  //Say hello :)
  add(new FlxText(0,0,100,"Hello World!")); 
}
override public function create():Void
{
  #if !neko
  FlxG.bgColor = 0xff131c1b;
  #else
  FlxG.bgColor = {rgb: 0x131c1b, a: 0xff};
  #end		
  FlxG.mouse.show();

  //Say hello :)
  add(new FlxText(0,0,100,"Hello World!")); 
}

 

 

 

Step 5. Compile Hello World

To compile Hello World run the following command from your project folder;

nme test flash

 

Haxe will now compile and you will get a nice "Hello World"

 

If you have any problems, please write a post in the help section of our forums.

 

One of the best things to do from here is to check out our Demos. All of the code for these demos and more is available on github at Beeblerox's Demo Repo