HaxeFlixel is an open source 2D game library written for use with the Open Flash Library and the Haxe Toolkit, it is completely free for personal or commercial use. This game library enables multi platform development for native targets on mobile and desktop as well as flash and experimental html5 support on web platforms. This project was founded by Alexander Hohlov, also known on Beeblerox on GitHub, who continues to be the project lead for the HaxeFlixel Organisation group. The project itself also has an active community with contributions from highly valued developers (by github names) crazysam, impaler, Werdn, ProG4mr, Gama11, sergey-miryanov and more. HaxeFlixel is largely based on the AS3 version of Flixel written by Adam “Atomic” Saltsman.

Post news Report RSS HaxeFlixel 3 Released!

HaxeFlixel 3.0.1 is the first full release of HaxeFlixel 3.

Posted by on

Changes for HaxeFlixel 3.0

This is the third big update to HaxeFlixel. Here are the biggest changes:

  • New Front End classes to better encapsulate FlxG functionality.
  • Refactored the animation system.
  • Better support for nested sprites via FlxSpriteGroup. FlxSpriteGroups can be contained within other groups, and behave like FlxSprites. They are expensive though, use them sparingly.
  • Moved lots of stuff into utility classes to reduce clutter in core classes.
  • Continued optimizations for cpp targets.

Upgrading from HaxeFlixel 2.x to 3.0

HaxeFlixel 3.0 is an evolution of the original Flixel api and while most of the API is very similar and quickly learnt, it requires some renames and modifications to update your code.

Major changes from version 2.10

We wanted to slim down up the core classes, which meant moving non-essential functionality into separate classes. We've also continued to focus on improving stability and adding features to the engine. Here's a quick overview of the biggest changes:

mySprite.animation.add(...);
mySprite.animation.play(...);
mySprite.animation.frameName = "String";
mySprite.animation.frameIndex = Int;

Feel free to inspect the advanced api features such as addByNames, addByStringIndicies, addByIndicies, addByPrefix, findSpriteFrame, and randomFrame.

  • Added new FlxKeyShortcuts class, which replaces FlxG.keys. FlxG.keys.pressed is no longer a function, it's now an object, ex: if( FlxG.keys.pressed.ANY ) {...}
  • Added new FlxSpriteGroup class, which allows an FlxGroup to behave like an FlxSprite. This is a powerful new construct that will simplify building UI controls.
  • FlxU is now gone, we've moved all its functionality to several utility classes that specific contain functionality, ex: FlxArrayUtil, FlxAngle, FlxMath, FlxRandom, FlxSpriteUtil, FlxVelocity, etc.
  • FlxSprite Filters are now in a separate FlxSpriteFilter utility class.

Package Structure

HaxeFlixel no longer has an org package. Everything is now included as flixel.package.Class. For most cases you can just remove org. from your import statements.

This was a decision the core developers agreed upon, to make the package structure simpler and detach HaxeFlixel from old flash conventions.

FrontEnds and the FlxG refactor

Frontends in HaxeFlixel 3.x are a new structure to the core of Flixel and which tackles the often criticized bloated collection of static methods in FlxG.

Frontends are accessed in FlxG.frontend in a similar fashion to what Flixel devs are used to. Careful thought has been given to organise them into logical shortcuts. This way the api will be easier browse, remember and maintain.

For example in HaxeFlixel 2.x to add a FlxCamera you would use FlxG.addCamera(camera:FlxCamera);, this addCamera method has been moved into a camera frontend with all the other camera related shortcuts.

So the code in HaxeFlixel 3.x to add a FlxCamera is now FlxG.cameras.add(camera:FlxCamera).
The Flixel FrontEnds are as follows:

  • FlxG.inputs
  • FlxG.console
  • FlxG.log
  • FlxG.bmpLog
  • FlxG.watch
  • FlxG.debugger
  • FlxG.vcr
  • FlxG.bitmap
  • FlxG.cameras
  • FlxG.plugins
  • FlxG.sound

More detail on the FrontEnds can be read on the FrontEnd docs page.

Core Assets

HaxeFlixel has system Assets for its debugger buttons, system sounds etc these assets were previously stored in every project in the assets/data folder. HaxeFlixel 3.x uses the OpenFL include.xml in core HaxeFlixel to omit the need to include them in every project.

So you dont need to have system assets anymore, everything in your project's ./assets/* folder should only be the assets you create.

New Debugger and Interactive Console

HaxeFlixel 3.x includes a powerful console and improved debugger. The new debugger system by default redirects the core trace() command to the log. Alternativley you can use FlxG.log.add() , FlxG.watch.add(), FlxG.log.warn and more.

New Flixel Command Line Tools

Our command line tools have been moved to an optional repository, so the old haxelib run flixel new command will not work.

Install the tools from haxelib just like flixel and run setup and follow the prompts:

haxelib
install flixel-tools
haxelib run flixel-tools setup

Now you can use the commands with just flixel, try the help command for more info.

flixel help

You can see the new template tool options with:

flixel help template

Also, there's now a shorthand version to create a template with a custom name:

flixel tpl -n "CustomProject"

Automatic find and replace

A collection of most of the API name changes were collected for the flixel-tools command line tool.
You can see what it replaces here.

To run the find and replace the command is simple:

flixel convert

For more information, see the upgrade guide in the HaxeFlixel documentation.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: