Hello,
I use dragonbones in scene from instance mode.
When map is changed dragonbones did’nt load a armature - no errors, no character, nothing. The firstone i do, is trying to switch level like:
game.scene.remove('SceneMain');
game.scene.add('SceneMain', SceneMain);
game.scene.start('SceneMain');
How do i inizialise a level
var SceneMain = new Phaser.Scene('SceneMain');
SceneMain.preload = function(){
this.load.dragonbone("doc",
"characters/doc/doc_tex.png",
"characters/doc/doc_tex.json",
"characters/doc/doc_ske.json");
}
SceneMain.create = function(){
this.add.armature("doc_skin", "doc");
}
When i for wxample copy a dragonbone json object, and do another name - it’s works.
All another objects lika a pics, textures, sounds works good.
If i destroy game object
game.destroy(true);
and then
game = new Phaser.Game(config);
it’s works well, but if I initialize the game object again, sometimes I have problems with the pointer
SceneMain.input.on ('pointerdown', function (pointer, obj) {
...
}
For example, variable worldX and Y is 0.
and
camera: undefined…
I can fix this with a setTimeout after game.destroy() but then sometimes i recive new error from dragonbones…
How can i reload a dragonbones whit out reloading a game?
Pls, help me
I tryed in classic mode, and it’s still not working. After scene changing, dragonbones no wanna loading arnature anymore.
<script>
let config = {
type: Phaser.WEBGL,
<!-- physics: { -->
<!-- default: 'arcade', -->
<!-- arcade: { -->
<!-- gravity: { y: 300 }, -->
<!-- debug: false -->
<!-- } -->
<!-- }, -->
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH,
width: 1920,
height: 1080
},
audio: {
disableWebAudio: true
},
plugins: {
scene: [
{ key: "DragonBones", plugin: dragonBones.phaser.plugin.DragonBonesScenePlugin, mapping: "dragonbone" }
]
},
};
var SceneA = new Phaser.Class({
Extends: Phaser.Scene,
initialize:
function SceneA ()
{
Phaser.Scene.call(this, { key: 'sceneA' });
},
preload: function ()
{
this.load.dragonbone("doc",
"characters/doc/doc_tex.png",
"characters/doc/doc_tex.json",
"characters/doc/doc_ske.json");
},
create: function ()
{
this.add.armature("doc_test", "doc");
this.input.once('pointerdown', function () {
this.scene.start('sceneB');
}, this);
}
});
var SceneB = new Phaser.Class({
Extends: Phaser.Scene,
initialize:
function SceneB ()
{
Phaser.Scene.call(this, { key: 'sceneB' });
},
preload: function (){
this.load.dragonbone("doc",
"characters/doc/doc_tex.png",
"characters/doc/doc_tex.json",
"characters/doc/doc_ske.json");
},
create: function ()
{
this.add.armature("doc_test", "doc");
this.input.once('pointerdown', function (event) {
this.scene.start('sceneA');
}, this);
},
update: function (time, delta){
}
});
var game = new Phaser.Game(config);
game.scene.add('SceneA', SceneA);
game.scene.add('SceneB', SceneB,true);
</script>