Open cpet opened 5 years ago
I figure it out that Phaser 3 is too old to run this demo, I will fix this problem this week and commit a PR.
It fixed at commit https://github.com/DragonBones/DragonBonesJS/commit/f1e0241ec3578273c7649a6a1844e7d16f9eaea4, you can run HelloDragonBones in Phaser/Demos with npm start.
The correct plugin configuration seems to be the one used in the index.html file. Something like this should appear on the main page for the example to work correctly: plugins: { scene: [ {
key: "DragonBones", plugin: dragonBones.phaser.plugin.DragonBonesScenePlugin, mapping: "dragonbone" } ] },
Also when I tried the above mentioned change in my config the dragonBones.js it asked me to configure it globally, triggered by:
if (!dbPlugin) throw new Error("Please add the dragonbone plugin in your GameConfig");
in DragonBonesScenePlugin.prototype, "factory" method.
After looking for solutions I messed up by local dragonBones.js and by luck alone ended up trying out the dragonBones.js from: https://raw.githubusercontent.com/DragonBones/DragonBonesJS/dev/Phaser/3.x/out/dragonBones.js
To my awe, it all started to work without error! I then looked for differences and it looks like this dragonBones.js contains a different implementation of the DragonBonesScenePlugin.prototype, "factory" method!
So it looks like the complete, working example needs to have the correct plugins configuration and the correct (updated) dragonBones.js lib file as well. Hopefully, now more people will be able to fully appreciate your work and use it in phaser3 projects as well.
I did a PIXIv4 with dragonbones.js animated characters project in the past. Frame rate was an issue on mobile due to the size of the game and the number of concurrent characters. Phaser3 does some nifty tricks: half screen size on mobile and batching that gives SOLID PERFORMANCE especially on mobile. So I really encourage people to support and give dragonbonesJS and phaser3 a shot, fixing the front page instructions will surely allow people to enjoy this awesome API.