Spine and DragonBones problems

Anyone here using Spine or DragonBones skeletal animations in their code? It’s so promising, but making it work seems like hell when everything is constantly changing. Some two years ago I actually managed to implement DragonBones plugin and it worked very well eventually, but now it doesn’t seem to work at all. It throws an error even upon the plugin declaration.

So I now went with the Spine plugin. Spine editor is a paid product, so I use DragonBones (DB) editor for creating the animations and export them to Spine format. The problem is that the Spine format exported by DB editor is outdated by now, so I needed to modify the exported JSON data structure before using it in the Phaser code. (If you want details, there are problems with the skins and with the animation curves.)

But I still can’t figure out the functionality besides just playing animations or changing slot attachments. I’d like to fade one animation into another (which did work when using DB plugin) or running an animation through specific parts of skeleton only, so that one can mix e.g. jumping and attacking. The documentation is somewhat crude and I have no clue what are some functions supposed to do. What is setAnimation and setMix, for example? Sounds interesting, but I can’t seem to make it work.

OK, I am starting to understand what’s going on there…
There are different tracks to play animations on. So if you want your dwarf to attack while jumping, you add a leg and body animation of jumping into the track 0, and an animation of swinging hands and axe into the track 1.

dwarf.addAnimation(0, ‘jump’);
dwarf.addAnimation(1, ‘attack’);

This way, both animations are executed independently at the same time.
You may also queue animations in the specific track, so that after one ends, the other starts. You can also set them certain delay to fade one into another! This is probably everything I wanted.
Spine is awesome!

Hi dude, im new in this too, have same questions about use dragonbones for my phaser project, currently it have some complicated to introduce, but it works for me.

Check out offical demo project here:

Also i’ve found so dirty but working project with this plugin.

1 Like

Hi dude! I don’t understand your spoken language, but from your repository I can see you managed to make the DragonBones plugin work - that’s great! My problem might have been that I didn’t declare the plugin as global too, only as scene. I didn’t know this option. Anyway, I eventually went with Spine and it already works well. It’s good to know how both ways are still possible!

I have another problem for spine/DB animators and programmers: How would you solve an advancing animation?
I mean an animation that also places the object somewhere else, like retreat when being hit, or move forward with the attack.

I suppose, the best way is to export the animation with the root (or body) of the object being displaced from [0, 0]. Then in Phaser, let the animation play. After it ends, return the root to [0, 0], and change the gameObject coordinates accordingly. Like this:

dwarf.setPosition(dwarf.x + dwarf.root.x * dwarf.scaleX, dwarf.y);
dwarf.root.x = 0;

But it doesn’t work. I even don’t know where is the problem. The object jumps in a confusing way, and seems to be misplaced, even though the JS console shows the correct coordinates.

Edit (second time):
One more line of code is needed:


And it works!
So I am now inclined to believe that the most accurate way for dealing with displacement animations is to set them displaced in DragonBones (or Spine) and then aligning them at runtime (when the animation ends) with the spineGameObject position.