Is DragonBones compatible with libGDX? - libgdx

I am trying to use DragonBone animations in my LibGDX game.
I am working on an endless runner game,so JSON levels will be loaded continuously and obstacles and coins get created each time level gets loaded.
Whenever I apply DragonBone animation for the obstacles,game is having a lag and white screen appears while executing code for collision.
Is DragonBone really compatible with LibGdx?
Or this problem occur because my code structure is not proper?(For each level,I am assigning DragonBone to each obstacles from a dragonBone array.Not able to use any loader for dragonBone also.Didn't get any code for that from net.)
Hope I will get some relevant suggestions.I am Really getting a hard time on this issue.

Related

FirefoxOS packaged game loading time

We are working on a packaged html5 game for the FirefoxOS marketplace.
Our game passes review, except the game shows a black screen before starting. The reviewers said this black screen shows for a very long time. It is my belief that the games wrapper is trying to load ALL assets before it shows the game.
The problem is, our game already has internal loaders that load portions of the game assets. Does anybody know how to tell the FirefoxOS packaged html5 app to let the game do all of the loading, so my preloaders can work?
I also use Flambe. Befor it can display anything, it should load at least the index.html, flambe.js (flambe project loader) and ofcourse main-html.js file (actual game code). From that point you could load other assets to display an actual preloader, but that could also take time. If you use FillSprites then it reduces some time.
But what I mostly do, is adding a simple CSS3 animation (loader) on top of the canvas. I give this html element a certain id, and when I have loaded enough to show the "real" preloader, I remove this CSS loader animation from the DOM. This allows to show a preloader very fast or to load a bit more designed preloader if you wish.

Flash Pro: Collision of objects only works correctly when on Frame 1

as you may have noticed just by reading the title it is quite hard to summarize the problem,
which is probably why I couldn't find a solution anywhere.
I am currently working on a flash game using adobe flash pro CC.
I started by creating the first level of my sidescrolling game and got everything to work just as I wanted it to. All my work was on a single frame (frame 1) and on a single layer and it worked fine.
However, when I then went on to move the frame a little further back and added frames in front of it for the menu I encountered a problem.
When I "gotoAndStop" to the frame with my game content on it, everything works except the collision between my character and my objects. My character is now sunk into the "floor object" about have his size, while when i move the frame back to "frame 1" everything works fine again.
I am losing my mind over this. Please help me :(
in flash when you start changing a dynamic property such as x or y, that object will be independent from the keyframe where it originally was ~forever~, even if you go back to the original keyframe. therefore if you start some enterframe and change the playhead afterwards you will get some awkward (but expected) behaviour.
ideally, jump to the game keyframe and just then call whatever methods needed to start the game.

AS3 - looping through movieclips and rasterizing them to bitmapdatas - how to be sure frames are ready?

this is a newer version to a question i have asked before but have not received an answer to.
I am developing a mobile AIR app with many animations and tests have shown that using bitmaps and GPU rendering give the best performance across all mobile models. I receive normal vector animations from the app's artists, and have built a system which loops through these animations at runtime and draws the content into bitmapdatas.
my concern is looping through the movieclip's frames. If I have these lines of code:
for (var i:uint=1; i<mc.totalFrames+1; i++) {
mc.gotoAndStop(i);
bitmapData.draw(mc);
}
I can't be sure the frame got "constructed" before being drawn, and my tests with an Android tablet prove this right - sometimes frames aren't drawn.
This mc is off the display list obviously (we dont need to render to the screen). So is there a way to make sure the frame has been built before drawing it to a bitmapdata? (and waiting for FRAME_CONSTRUCTED, EXIT_FRAME, etc.. is obviously slow and unneeded)
any ideas?
thanx
Saar
more info to clarify:
this is a children's book. each page has animations in it. all these animations are vector animations in timelines in FLAs I receive from the devloping artists (not the users).
Every page has an FLA which i publish to a swf.
what i actually do is replace vector animations in loaded SWFs with bitmap version of them.
At app runtime, upon each new page, i load the swf, go though all the animations in it (looping through the content's children) and each movieclip i rasterize into array of bitmapdatas.
My custom "Bitmap Movieclip" places on the displaylist a replcaement bitmap for each movieclip, and on ENTER_FRAME i switch the bitmaps' bitmapdatas from the array.
this gives very hight performance
I'd suggest use a splash screen, and place your MC to be converted to the bitmap to the stage first, then draw to your bitmapData. Several issues had me force to put a DisplayObject being drawn to the stage before actual drawing once already, so this might be a quick fix for you too.
var splashBD:BitmapData=new BitmapData(stage.stageWidth,stage.stageHeight,false,0xffffff);
var splashBM:Bitmap=new Bitmap(splashBD); // draw a thing as needed here
addChild(splashBM);
addChildAt(MC_to_convert,getChildIndex(splashBM));
// then advance it by frames and draw.
sorry MY BAD
waiting for FRAME_CONSTRUCTED is the answer

3D transforms on loaded SWFs aren't working

Here's the scenario:
Our creative team produces SWF animations in the Flash CS5 authoring tool that we (the engineers) load at runtime into a project built using the Flex SDK. Animations that don't use the "3D rotation tool" work just fine.
Animations that use the 3D rotation tool give the following behavior:
MovieClips that have 3D tweens applied using the 3D rotation tool show up in the top-left corner of the stage as if they had no transform at all (i.e. as if their Matrix3D was being ignored, and their Matrix was identity)
MovieClips that have normal 2D tweens animate properly
Alpha and other non-affine properties tween properly
Both 3D and non-3D animations play fine when loaded by themselves in a browser tab or the standalone flash player. 3D is only broken when loaded into our code generated SWF.
So it seems that for MovieClips with 3D transformations applied in the CS5 authoring environment, those transformations aren't being applied / respected when the SWF is loaded by our code SWF.
This is my first foray into 3D, so I'm not sure what could be causing this, but here's what I've tested / checked / tried, all to no avail:
I've ensured that actionscript 3 and Flash Player 10 / 10.1 is selected in the authoring environment.
I've tried loading animations into code SWFs built using Flex 4.1, 4.5, and 4.6 at Flash player versions 10.0, 10.1, 10.2, and 11
I've applied Matrix3D to the containers that load the SWF animations, both identity and rotated. I can see the rotated containers do work with 3D in perspective, so I know that my code SWF is 3D capable.
I'm hoping there's some simple trick, some setup I'm missing. Thanks for your help!
This may be something that is going on in your Flex code, such as stopping the animations, or not starting them. Can you post the code that you use to load the SWFs?
This may be a race condition, too. You may have to wait until the SWFs are loaded (e.g., addedToStage events or the like) before using them.
I came across your problem because I had exactly the same issue... And after a lot of poking around, the solution (for me) boiled down to this:
If, at any point, you are strong-typing your CHILD swf to a class, or referring to any of its variables using dot syntax from the PARENT, it breaks. Even if it's just a trace message.
I had to replace this:
var stoneVideo:StoneVideo = loader.content as StoneVideo;
stoneVideo.stoneText = model.stoneText;
With this:
loader.content["stoneText"] = model.stoneText;
And it started working properly. Hope this helps!
I can't post code, but it turns out it was an overly cautious subtlety in our loader code that had never caught us before:
We have a custom class that loads all images for us (including a few utilities and common functionality built in). On load complete, this code took the loader.content, added it as a child to itself, and -- here's the kicker -- cleaned up the no-longer-necessary loader using close() and unloadAndStop().
I suppose it seemed rational to cleanup the loader in this way, and it has always worked until now (with static images, static SWFs, and SWF animations), but it caused the above issue upon loading 3D swfs (and it turns out this also caused odd URL not found errors on loading video SWFs).
Disabling the overly cautious Loader cleanup fixed my problem.

AS3: Sound.play() stops animation, why?

I have a working Flash movie, using a couple of AS3 scripts. The main stage has some animation going on. My player.as plays some mp3 clips when I click a button. The problem is, the stage animation stops as soon as the sound starts ie. Sound.play() starts, then animation starts again when the sound ends.
The animation is based on
this.addEventListener(Event.ENTER_FRAME,loop3D);
so I gather something happens to ENTER_FRAME due to Sound.play(). What is weird is everything works perfectly on the Flash Test movie (ctrl+Enter). The animation does NOT stop during sound. What to do to make sure the animation goes on always?
There is no inherent problem with playing sound and animation at the same time, nor is there one with combining a (however large) number of class files - you have another problem. There must be an error causing the Flash player to suspend execution of ActionScripts, and it is most probably one of these:
A security sandbox violation.
An IO error or a problem related to playing stuff that has not yet completed loading.
A problem related to loading classes from a separate SWF.
Some other problem causing a null pointer exception.
To debug this, first check your flashlog.txt. If you don't have one, set up the Flash content debugger plugin. See what error codes are thrown, go on from there.