Jump to content

Spriter for Haxe/OpenFL and HaxeFlixel


Recommended Posts

Seems there are a couple of libraries available for the Haxe/OpenFL/HaxeFlixel platforms that I've found:

 

OpenFL:

https://github.com/loudoweb/SpriterHaxeEngine

 

HaxeFlixel (for latest dev build?):

https://github.com/Beeblerox/SpriterHaxeEngine/

 

HaxePunk:

https://github.com/ibilon/HaxePunk-Spriter

 

NME (OpenFL?):

https://github.com/po8rewq/hxSpriter

 

I'm trying to get the HaxeFlixel one to work but is lacking in noob friendly documentation. If anyone gets it to work, please post how you did so here.

 

Link to comment
Share on other sites

To get SpriterHaxeEngine working with HaxeFlixel, use the following base code to get started:

 

//In PlayState.hx...

 

import spriter.engine.SpriterEngine;
import spriter.library.FlixelLibrary;
import flixel.group.FlxTypedSpriteGroup;
   
class PlayState extends FlxState
{
    //Variable declarations
    private var _spriterGroup:FlxTypedSpriteGroup<FlxSprite>;
    private var _spriterEngine:SpriterEngine;
    private var _spriterLib:FlixelLibrary;
    
    //In create() function
    override public function create():Void
    {
        createSprite();
        add(_spriterGroup);
    }
    
    //Function to create spriter object
    function createSprite() {
        _spriterGroup = new FlxTypedSpriteGroup<FlxSprite>();
        _spriterGroup.antialiasing = true;
        _spriterGroup.pixelPerfectRender = false;    
        
        _spriterLib = new FlixelLibrary(_spriterGroup, "assets/images/sprites/");
        
        _spriterEngine = new SpriterEngine(Assets.getText("assets/data/YourCharacter.scml"), _spriterLib, null);
        _spriterEngine.addEntity("EntityName", 120, 460);
        _spriterEngine.getEntity("EntityName").playAnim("AnimationName");
        
        //update on enter frame
        _spriterEngine.update();
    }
    
    //And in update() function below super.update()...
    override public function update():Void
    {
        super.update();
        _spriterEngine.update();
    }
    
}

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

you should use the first one because I always accept pull request from HaxeFlixel team.

The two last ones are too old, they are lacking features and they are probably buggy.

 

I plan to make my library framework-agnostic so you will be able to run with Flambe as well for example. There is already a fork of my library working with Flambe somewhere but it misses last features and bugfixes.

 

Also you can find samples here.

Link to comment
Share on other sites

  • 2 months later...

Just a quick post to remind that this implementation is complete (include subentities, variables, bones...) and I plan to add some features (mapping with regexp, ...).

Well, almost actually, I didn't make the Sound implementation because I don't think an animation engine should handle sounds, but the variables or tags features should make the trick. :)

I've also made my own atlas exporter for TexturePacker and you can even make a binary of an scml (avoid to parse the xml during runtime).

 

I'm currently improving the library to have better performance.

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...