loudoweb / spriterhaxeengine Goto Github PK
View Code? Open in Web Editor NEWEngine to use Brashmonkey's Spriter SCML for haxe.
License: MIT License
Engine to use Brashmonkey's Spriter SCML for haxe.
License: MIT License
Context could allow to let users define specific shader or other custom data to a Spriter character and use it in their custom Rendering Libraries.
The following error is not letting me compile using the latest Haxe:
C:/HaxeToolkit/haxe/lib/SpriterHaxeEngine/2,0,0/spriter/definitions/Metaline.hx:9: characters 9-38 : Warning : Structures with new are deprecated, use haxe.Constraints.Constructible instead
Hello,
I'm trying to implement spriter with HaxeFlixel using SpriterHaxeEngine.
The problem I encountered is that I can't flip the spriter sprites.
I tried this:
if (flipX)
{
//spriterAnims.info.scaleX = -1;
spriterAnims.info.scaleY = -1;
}
else
{
//spriterAnims.info.scaleX = 1;
spriterAnims.info.scaleY = 1;
}
But id does crazy things. Is there any solution?
Pooling will be a great improvement. I began to implement it (5443ab4)
When all objects that are instanciated many times per frames will be ready for pooling, it will be great to use typedef or something else to fallback to a specific pooling system from a framework (flixel, flambe, etc.)
example---
If you try to put spriter objects side by side like in a tile map on windows or android. you will see a noticeable gap between the images. publishing to htlm5 or flash does not have this problem.
I have tested this with bitmapLib and SimpleBitmapLib. and they work fine. the problems seems to only occur when using the TilelayerLib
haxelib upgrade does not download the most recent update. had to download the files manually and copy them over SpriterHaxeEngine Folders
What licence is this released under? Thank you.
Placement is off. It's consistently off on all targets (Neko, HTML5, CPP) except Flash, where it's still off by a pixel but to the right instead of the left. It may not make a difference in large images, but in pixel art, being off by one pixel is a lot.
This happens on both the SpriterLibrary and the FlixelLibrary so I don't think it has anything with the library implementation.
I'm using this code to get the spriter:
headSpriter = PlayState.instance.engine.addSpriter("head",X,Y);
headSpriter.info.x = FlxG.width *0.75;
headSpriter.info.y = -FlxG.height * 0.75;
To play:
headSpriter.playAnimFromEntity("cabeza", "transicionAIdleCabeza", toIdleAnim, true);
On update I want to get the list of points and place eyes over them:
var points:Array<SpatialInfo> = headSpriter.getPoints();
var point:SpatialInfo;
for (i in 0...points.length)
{
point = points[i];
var eye = arrayEyes[i];
eye.setPosition( point.x, point.y);
}
But the eyes are not showing where they suppose to go.
Works fine for html5 without the png now
still works fine with 1.4.0, but on 1.4.1. can not see enitiy everything spriter related is blank
can we have haxeflixel source code examples of running simple Spriter bone animation?
Mentioning HaxePunk and not HaxeFlixel? Shame on you!
to support openfl 4.0.2
...in progress...
I think this is derived from bug #23
I made a demo with a stripped version of the platformer I'm making to test the animations using HaxeFlixel and the demo animations from spriter:
https://dl.dropboxusercontent.com/u/24695185/HaxeFlixelSpriterTest.rar
Some of the animations "explode" when are playing.
For the project I'm using the latest dev flixel and SpriterHaxeEngine. Notice that I added _dev to the names of the libraries.
@sruloart, maybe we can use this demo for HaxeFlixel when the issues are fixed?
This engine is compatible with scml made with Spriter b6.1.
It needs now compatibility with scml b7 since Brashmonkey released a new version of Spriter few days ago.
these two functions do not work in html5 when using the bitmap library but appear to work fine on all other targets.
playAnim();
playEntity();
for now tile Layer seems to work fine when targeting html5
Hi! While playing around with a test animation, I noticed that the the easing tween between frames in Spriter aren't working/implemented yet. Animation tweens only play in a linear way.
curveType
is only loaded when the <key>
is inside <timeline>
.
When curveType
is inside <mainline>
, it isn't loaded. EDIT: and the curveType
follows the one specified in <key>
inside <timeline>
.
Version of runtime: haxelib
EDIT: interestingly, curveType
of MainlineKey isn't specified in the scml reference. But the editor is generating mainline key with curveType
as of R5. And the behavior of the editor is that the curveType
of MainlineKey overrides TimelineKey. Maybe time to ask the guys in BrashMonkey for explanation?
EDIT: I've checked their C++ reference implementation. Their MainlineKey has a TimeInfo, which has an EasingCurveInterface
. Their EasingCurveInterface
is inherited by implementation of curve, such as InstantEasingCurve
and CubicEasingCurve
. Therefore, their MainlineKey is indeed capable for storing curveType
. Maybe their scml documentation is outdated?
Like this Bardbarian's guys trick (later in the thread): http://forum.starling-framework.org/topic/json-or-xml: "what we did with Bardbarian: With over 30 SCML files to load, it was starting to get really slow. So we just added some code to our startup, to cache them all in a binary file.
Just make a big hash of all your StarlingAnimation instances, then use writeObject to store in a bytearray, and save to a little file "animations.bin".
When on the device, load the bin file, and extract each animation. Load times go from like 3000ms, to 10ms [:D]
WRITE:
var f:File = AirUtils.projectFolder.resolvePath("src/assets/spriter/scmlCache.bin");
var ba:ByteArray = new ByteArray();
ba.writeObject({sd: animationsByName, hd: animationsByNameHd});
ba.compress();
var fs:FileStream = new FileStream();
fs.open(f, FileMode.WRITE);
fs.writeBytes(ba, 0, ba.bytesAvailable);
fs.close();
READ:
var ba:ByteArray = new ByteArray();
var stream:FileStream = new FileStream();
stream.open(cacheFile, FileMode.READ);
stream.readBytes(ba, 0, stream.bytesAvailable);
stream.close();
ba.uncompress();
animationsByName = scale == 1? ba.readObject().hd : ba.readObject().sd; "
public function setCurrentTime(newTime:Int, library:AbstractLibrary, root:IScml):Void
{
var currentTime:Int;
var loop:Int;
switch(loopType)
{
case LOOPING:
loop = Std.int(newTime / length);
currentTime = newTime % length;
//callback
if (loop == 1){ <---remove bracket------!!!!!!!!!!
root.onEndAnim(name);
case NO_LOOPING:
currentTime = Std.int(Math.min(newTime, length));
//callback
if (currentTime == length)
root.onEndAnim(name);
}
I use Spriter only for particules in my game, so in my SCML file, I have juste one entity with all the particules animations.
When I add an particule to the game (new Spriter obj to the SpriterEngine obj), I suppose creating a particule (new Spriter obj) copy all the SCML animations just for using one of them.
What do you think of the possibility to create a light particule Spriter obj with a unique specified animation (with autoDestroy boolean parameter) ?
Maybe like that :
function addParticule(_entity:String, _animation:String, _autoDestroy:Bool):Spriter
{}
It's because the repo ("spriter") is inside a "haxelib" folder for some reason...
Reference file for reproducing the bug is available here
Expected output of engine.getEntity('test').playAnimFromEntity('scene', 'MoveAnimation')
(Due to technical issue, the gif below is playing slower than it should):
However, the runtime cannot animate the subentities. Here is the actual output
Notice that the blue balls don't rotate as it should.
Is it possible to play an animation from finish to start?
Got this error due to HaxeFlixel's updated structure:
/usr/lib/haxelib/SpriterHaxeEngine/1,6,0/spriter/library/FlixelLibrary.hx:4: characters 7-44 : Type not found : flixel.graphics.frames.FlxAtlasFrames
FlxAtlasFrames does not exist anymore.
not very optimised, but it can make the deal in some cases :
if(spatialResult.angle == 0 && spatialResult.scaleX == 1 && spatialResult.scaleY == 1 && spatialResult.a==1)
{
_point.x = spatialResult.x;
_point.y = spatialResult.y;
_canvas.copyPixels(bmp, bmp.rect, _point,true);
}
else
{
_matrix.identity();
_matrix.scale(spatialResult.scaleX, spatialResult.scaleY);
_matrix.rotate(SpriterUtil.toRadians(SpriterUtil.fixRotation(spatialResult.angle)));
_matrix.translate(spatialResult.x, spatialResult.y);
_canvas.draw(bmp, _matrix, new ColorTransform(1,1,1,spatialResult.a), null, null, true);
}
When using a looping animation in a sequence of animations with playAnimsStack(), the transition is not smooth. However the very same sequence with the animation set to looping false is smooth.
So we need to see why the transition is incorrect between a looping animation and an other animation on the playAnimsStack function.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.