proyecto26 / ion-phaser

A web component to use Phaser Framework with Angular, React, Vue, etc 🎮
https://market.ionicframework.com/plugins/ionphaser
MIT License
251 stars 39 forks source link

Cannot add 2 different scenes to the game config #26

Closed gilbertoalmeida closed 3 years ago

gilbertoalmeida commented 3 years ago

Hi, thanks for the work on this.

I am trying out creating a game in react with ion-phaser and I am running into this problem that I cannot add 2 different scenes to the game config.

This is how App.js looks like. I notice that only the last scene in the Array (GameScene) is loaded. If I invert the order in the array, only the other one is loaded.

import React from 'react'
import Phaser from 'phaser'
import { IonPhaser } from '@ion-phaser/react'
import { BootScene } from "./BootScene"
import { GameScene } from "./GameScene"

function App() {
  const state = {
    initialize: true,
    game: {
      width: "100%",
      height: "100%",
      type: Phaser.AUTO,
      scene: [BootScene, GameScene]
    }
  }

  const { initialize, game } = state
  return (
    <div className="App">
      <IonPhaser game={game} initialize={initialize} />
    </div>
  );
}

export default App;

I tried out in a simple HTML with just pure phase and both Scenes are loaded normally.

Here's a simple repo for reproducing: https://github.com/gilbertoalmeida/ion-phaser-2-scenes

jdnichollsc commented 3 years ago

Thanks for sharing the repo, let me try ASAP :)

gilbertoalmeida commented 3 years ago

hi Juan, did you have a chance to look into this?

jdnichollsc commented 3 years ago

Sorry for the delay, try creating a config scene like this: https://github.com/proyecto26/ion-phaser/blob/develop/demo-angular/src/app/app.component.ts#L52

jdnichollsc commented 3 years ago

Let me know if the issue persist, thanks!