Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

quinnhoener/SpriterHaxeEngine

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
48 Commits
 
 
 
 
 
 

Repository files navigation

SpriterHaxeEngine

The point of this project is to offer a Brashmonkey's Spriter SCML renderer compatible with Haxe 3 and openfl. Base code of SCML definitions from http://www.brashmonkey.com/ScmlDocs/ScmlReference.html Inspired by

Install it: haxelib install SpriterHaxeEngine

Configure it:

//set the root canvas where to add all the animations
var canvas:BitmapData = new BitmapData(800, 480);
var spriterRoot:Bitmap = new Bitmap(canvas, PixelSnapping.AUTO, true);

//you can use a different library to feet your needs. This one use BitmapData.copypixels() and BitmapData.draw()
var lib:BitmapLibrary = new BitmapLibrary('assets/', canvas);

//here is the engine : it will update all your Spriter's entities
engine = new SpriterEngine(Assets.getText('assets/test.scml'), lib, null );
		
//to add and entity
engine.addEntity('entityName', x,  y);

//set the "run" animation of the entity
engine.getEntity('entityName').playAnim('run', myCallback);

//apply the "gun" map of the entity
engine.getEntity('entityName').applyCharacterMap('gun', true);

//update on enter frame
engine.update();

//callback on end anim
function myCallback(s:Spriter, entity:String, anim:String):Void

//var and tag callback
engine.getEntityAt(0).scml.tagCallback = function tagCallback(tag:String):Void{}
engine.getEntityAt(0).scml.varChangeCallback function varCallback(variable:Variable<Dynamic>):Void{}

//points and boxes
var points:Array<SpatialInfo> = engine.getEntityAt(0).getPoints();
var boxes:Array<Quadrilateral> = engine.getEntityAt(0).getBoxes();

Spriter Haxe Engine Features

SCML API

Engine

  • Can be overrided to fit your need
  • simple z-ordering
  • Fixed tick, variable tick or use your own time
  • Pause
  • simple auto removal

Spriter entity

  • character mapping by name
  • change animation easily by name in a Spriter entity
  • callback when animation ended
  • play, stack anim, pause
  • you can display duplicate of spriter entity and manipulate them separatly
  • callback when variable changes
  • callback when tag dispatches
  • Points (usage example : to shot a bullet when gun fire)
  • Boxes (usage example : hitbox)

Libraries

  • Simple bitmap library (bitmaps handled with addChild)
  • BitmapData library (copypixels)
  • Tilelayer library (drawTiles)(dependency : https://github.com/matthewswallace/openfl-tilelayer).
  • Flixel Library (atlas support or bitmaps handled with addChild)
  • override the AbstractLibrary to provide a new library

Cross-platform

  • flash
  • windows
  • neko
  • android
  • html5

TODO

  • add tilesheet stage 3d support : https://github.com/as3boyan/TilesheetStage3D/
  • add ash and haxepunk support
  • Optimized engine : draw call only when needed. So "instant" keys are not updated between keys.
  • animation callback optimization
  • check Garbage collector
  • binary scml

Examples

Additional information

  • compatible with Spriter b8
  • With Tilelayer library, don't use openfl-bitfive for html5 target.

Known issues

  • interpolation are not enough smooth at the end of a looping animation (need to check if the interpolation with the first frame is ok)
  • [html5] some issues on html5 depending on the backend used and the Library used.
  • [neko] if you have trouble with TileLayerLibrary, please update tilelayer with : matthewswallace/openfl-tilelayer#5

About

Engine to use Brashmonkey's Spriter SCML for haxe.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.