Hi there,
im using Phaser with Typescript and in only allows me to select one scene. (Without using an array in scene parameter)
If I use an array of Scenes in the scene parameter, it gives me the following error:
TS2345: Argument of type '{ type: number; width: number; height: number; physics: { default: string; arcade: { gravity: { y: number; }; }; }; scene: (typeof GameScene)[]; }' is not assignable to parameter of type 'GameConfig'.
Types of property 'scene' are incompatible.
Type '(typeof GameScene)[]' is not assignable to type 'Function | Scene | SettingsConfig | Scene[] | SettingsConfig[] | CreateSceneFromObjectConfig | CreateSceneFromObjectConfig[] | undefined'.
Type '(typeof GameScene)[]' is not assignable to type 'Scene[]'.
Type 'typeof GameScene' is missing the following properties from type 'Scene': sys, game, anims, cache, and 22 more.
I have the following setup when having the error:
import Phaser from "phaser";
import guitar_sound from "../common_assets/sounds/395217__ueffects__guitar-tune-3-sailsmen.wav";
class GameScene extends Phaser.Scene {
constructor() {
super("FirstScene");
}
init() {}
preload(): void {
this.load.audio("guitar_sound", guitar_sound);
}
create(): void {
this.add.text(20, 20, "Loading game...");
// TODO
}
update(time: number, delta: number): void {
// TODO
}
}
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
physics: {
default: "arcade",
arcade: {
gravity: { y: 300 }
}
},
scene: [GameScene]
};
export class StarfallGame extends Phaser.Game {
constructor(config: Phaser.Types.Core.GameConfig) {
super(config);
}
}
window.onload = () => {
var game = new StarfallGame(config);
};
Donāt know if I am doing something wrong but I look already a lot of tutorials and it seems im doing goodā¦
Thanks in advance for the help