Closed
Description
Version
- Phaser Version: 3.55.2
- Operating system: MacOS
- Browser: Chrome
Description
Scene Order
[SceneA, SceneB]
Invoke the following method:
ScenePlugin.moveBelow(keyA, keyB)
Expected
Scene Order should be retained. [SceneA, SceneB]
Actual
Scenes are swapped even though SceneB is already below SceneA. [SceneB, SceneA]
Example Test Code
class Controller extends Phaser.Scene {
constructor ()
{
super({ key: 'Controller', active: true });
}
create ()
{
this.input.on('pointerdown', function (pointer) {
this.scene.moveBelow('SceneA', 'SceneB');
}, this);
}
}
class SceneA extends Phaser.Scene {
constructor ()
{
super({ key: 'SceneA', active: true });
}
create ()
{
this.add.rectangle(340, 300, 64, 64, 0xff33cc);
}
}
class SceneB extends Phaser.Scene {
constructor ()
{
super({ key: 'SceneB', active: true });
}
create ()
{
this.add.rectangle(380, 300, 64, 64, 0xbbb3cc);
}
}
let config = {
type: Phaser.AUTO,
width: 800,
height: 600,
parent: 'phaser-example',
scene: [ Controller, SceneA, SceneB ]
// When left mouse is clicked, SceneA and SceneB will be swapped regardless of the order
};
let game = new Phaser.Game(config);
Additional Information
Solution
I think we would just need to check that the index of the first parameter of the method (keyA) is greater than the index of the second parameter (keyB).
I'm assuming the same issue might occur with the moveAbove as well.
Metadata
Metadata
Assignees
Labels
No labels