Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add 2 different scenes to the game config #26

Closed
gilbertoalmeida opened this issue Dec 21, 2020 · 4 comments
Closed

Cannot add 2 different scenes to the game config #26

gilbertoalmeida opened this issue Dec 21, 2020 · 4 comments

Comments

@gilbertoalmeida
Copy link

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
Copy link
Member

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

@gilbertoalmeida
Copy link
Author

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

@jdnichollsc
Copy link
Member

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
Copy link
Member

Let me know if the issue persist, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants