I am working with multiple scenes, where there is a mini-game within a game. I’m trying to get the code from the multi-scene demo to work, using some of that code to launch my own single scene as a popup window, but I’m finding it hard to parse. It would be really useful if the examples were commented!!
So I think my problem is the createWindow function:
createWindow (func)
{
var x = Phaser.Math.Between(400, 600);
var y = Phaser.Math.Between(64, 128);
var handle = 'window' + this.count++;
var win = this.add.zone(x, y, func.WIDTH, func.HEIGHT).setInteractive().setOrigin(0);
var demo = new func(handle, win);
this.input.setDraggable(win);
win.on('drag', function (pointer, dragX, dragY) {
this.x = dragX;
this.y = dragY;
demo.refresh()
});
this.scene.add(handle, demo, true);
}
My questions are: What is “count”? Why are we counting the window? What is “demo”? And what is the third parameter for in “this.scene.add(handle, demo, true)”?