Funny error: scene or super key error?

I’ve been developing my game for some weeks now and have made some scenes. Just recently, I suddenly can’t access my old scenes, and somehow I can’t run a specific scene based on its super key

Here’s the code:
main.js
/** @type {import("../typings/phaser")} */

import { SOpening } from "./scenes/SOpening";
import { STestGround } from "./scenes/STestGround";
import { SWareHouse } from "./scenes/SWareHouse";
import { SPentapolis } from "./scenes/SPentapolis";
import UIPlay from "./UI/UIPlay";

var config = {
type: Phaser.AUTO,
width:800,
height:600,
pixelArt: true,
scale:{ 
    parent:'myGame',
    // autoCenter:Phaser.Scale.CENTER_BOTH
},
physics:{
    default: 'matter',
    matter:{
        gravity:{y:0.4},
        debug:false
    }
},
scene:[
    STestGround,
    SPentapolis,
    SWareHouse,
    UIPlay,
    SOpening, 
]
};

let game = new Phaser.Game(config);

CST.js

export const CST={

    SCENES:{

        UIPlay:"UIPlay",

        SOpening : "SOpening",

        STestGround:"STestGround",

        SWareHouse:"SWareHouse",

        SPentapolis:"SPentapolis",

    }

}

STestGround.js

import { CST } from "../CST";
export class STestGround extends Phaser.Scene{
    constructor() {
        super({
            key: CST.SCENES.STestGround
        })
    }

    init(){
    }

    preload(){
    }

    create(){
        console.log("Test");
    }
}

As far as I concern, I’ve never touched one of those files while I was working on the other scene.

When I run the game, instead of playing STestGround, the game runs the UIPlay. Also, if I put SOpening as the first scene to be played, the game won’t let me, instead it runs the another random scene.

The only scene that works fine is SPentapolis. However, when I want to run another scene from SPentapolis, I can’t.


Can anybody help me,please… :frowning:

You are starting another scene with
this.scene.start(CST.SCENES.SOpening)

Effectively stopping the current scene.

Maybe you want to use scene.launch or scene.run

Thanks for replying! I have edited the post and my own code, but the problem hasn’t been solved.

You see, I just found something weird. Everytime I alter the order of the scenes in this line of code in main.js, the scene that will be run by the game will be different.

scene:[
    STestGround,
    SPentapolis,
    SWareHouse,
    UIPlay,
    SOpening, 
]

For example, if I change the code above to this code below, the first scene that will be run by the game will be different, even though STestGround is the first scene to be executed:

scene:[
        STestGround,
        SWareHouse,
        SOpening, 
        SPentapolis,
        UIPlay,
    ]

any idea why?

Do you have the project hosted anywhere? I could take a look at the whole thing. I don’t see anything jumping out at me here.

You know what. I copy-pasted the same code in those js files to new blank files, configure them in main.js and CST.js, and used those new files the same way I used the old file, and it worked. Well, kind of… :frowning:

I don’t really know how to use GitHub. I’ll try to upload it there if I can.

sorry to bother you again. Here’s the repo for my game in Github : click

It’s a jungle, my codes are not very clean, so it’s totally fine if you want to ignore this error.

Thanks for the help, anyway. People like you always make my day. :laughing: