Posts tagged Flixel
HxSpriter released
0HxSpriter is the Haxe implementation of the Spriter application and file format.
It’s a port a the SpriterAS3 lib, but working with NME. It basically lets you use Spriter with your games or applications.
First of all, what’s Spriter?
Spriter is a powerful animation tool for creating highly detailed 2d real-time game characters and effects in an intuitive, visual editor. The characters are saved to a format that allows game engines to produce higher quality visuals, while also using less video ram, and requiring less disk space per frame than traditional 2d sprite animation.
Spriter also provides several game specific features like collision boxes, and sound effect triggering, and saves to an open format that will be useable across many different game engines and platforms.
Spriter is currently in an usable beta state, but it’s really subject to changes, so the various implementations might stop working from a version to another, and they will need constant updating. The file format may also get incompatible across future versions, and the application may cause some crashes. For these reasons, Spriter is not production ready, but you can test it and play with it if you want.
How to use it ?
To use it, just install it from haxelib :
haxelib install HxSpriter |
In your NME file, you have to define a sprites directory (just rename the directory where you have all your Spriter’s animations).
<assets path="path/to/the/sprites/directory" rename="sprites" /> |
Now, if you want to use the library :
var spriter : BitmapSpriter = new BitmapSpriter('BetaFormatHero.SCML', 100, 300); spriter.playAnimation('idle_healthy'); addChild(spriter); |
Or with the Flixel port :
var spriter : FlxSpriter = new FlxSpriter('BetaFormatHero.SCML', 100, 300); spriter.playAnimation('idle_healthy'); add(spriter); |
Or with HaxePunk :
var spriter : HxpSpriter = new HxpSpriter('BetaFormatHero.SCML', 100, 300); spriter.playAnimation('idle_healthy'); addGraphic( spriter ); |
You can also checkout the repository : https://github.com/po8rewq/hxSpriter.
FlxCollisions port to Haxe
0Here is the FlxCollisions demo ported to the Haxe version of Flixel. Watch the FPS value of the Android version… just awesome! This demo uses the tmx file to generate the level (Tmx library).
Tmx format with Flixel Haxe
1During the past few days, I’ve been working with the HaxePunk framework to develop a game. But because of a lack of performance on Android (and no time to try to fix it), I’ve tried the Flixel port to see if I could build a game quickly.
First of all, I’ve tried the example based on Demo on my Android device and… surprise, the game turns at 50-60 FPS. So against my heart, I decided to start building my game on Flixel (actually, I really prefer the HaxePunk structure).
First of all, I tried to remember how Flixel works (I’ve already used it on My Hero Factory…).
So I started to initialise a project, and tried to import a level I’ve made with Tiled Map Editor… only to discover the tmx format is not supported in Flixel o_O.
Thanks to Matt Tuttle, the library is already ported to HaxePunk (the original one was from Thomas Jahn) so it was not difficult to make it work with Flixel.
So here is how you used it (make sure to download the sources) :
// Create a TmxMap with a tmx file var tmx : TmxMap = new TmxMap( nme.Assets.getText('levels/map01.tmx') ); // Basic level structure var t:FlxTilemap = new FlxTilemap(); // Generate a CSV from the layer 'map' with all the tiles from the TileSet 'tiles' var mapCsv:String = tmx.getLayer('map').toCsv( tmx.getTileSet('tiles') ); t.loadMap(mapCsv, "gfx/tiles.png", 8, 8, FlxTilemap.OFF); add(t); |
And that’s it! Of course if you want to have collisions detections, just add:
override public function update() { super.update(); FlxG.collide(_player, _tilemap); } |
