I am working on a game where I have different environments in separate scenes. The scenes are randomly selected. Everything is working as expected, until it doesn’t. I can’t find a pattern to when it stops, but it is always the scene that is listed last in config that is affected (I have switched the order to test). The scene creates properly, but the player won’t move with key commands.
Any ideas on a solution? I’ve considered that this may not be how scenes were intended to be used and this is entirely the wrong approach for what I want to do.
The current scenes:
scene: [Start, ShallowSea, OpenOcean]
Here is the create function in the Start scene. The start scene currently preloads all images and has a “click to start” message. On the click, a random scene is selected. This function is used again when the player completes each scene.
create(){
this.add.image(400, 300, ‘clickStart’);
this.input.once(‘pointerdown’, selectScene, this);
}
The function to randomly select the scene
function selectScene(){
var sceneSelect = Phaser.Math.Between(1, 2);
if (sceneSelect == 1){
var ecosystem = ‘openOcean’
} else if (sceneSelect == 2){
var ecosystem = ‘shallowSea’
}
this.scene.start(ecosystem);
}
Here is a link to the current game: https://taxonomygame.netlify.com/
The gray oval functions as the player. Entering the circle thing at the end starts the next scene.