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

How to upgrade to Phaser 3.52.0 #27

Closed
ccolomboext opened this issue Jan 27, 2021 · 14 comments
Closed

How to upgrade to Phaser 3.52.0 #27

ccolomboext opened this issue Jan 27, 2021 · 14 comments

Comments

@ccolomboext
Copy link

Right now the version of Phaser is freezed at 3.19.0 and I'm getting a lot of errors that, according to the developer, would be solved by upgrading it.

Is there any way to upgrade it?

@jdnichollsc
Copy link
Member

Ok give me a moment to fix the issue with this peer dependency

@NilsMinor
Copy link

Hey @jdnichollsc any updates on this topic? I also would like to use phaser 3.52 but ion-phaser depends on 3.19 :)

@ccolomboext
Copy link
Author

ccolomboext commented Feb 12, 2021

Hey @NilsMinor,

As a workaround I endup creating a React componenet that manages Phaser's game instance. Here follows the base code for the componenet, maybe you'll have to tweak your CSS to actually show the canvas but that depends a lot on your layout. Hope it helps, beign that I'm not sure you're using React....

import React from "react";
import Phaser from "phaser";

let game = null;

class Game extends React.Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <div id="game-container"></div>
    );
  }

  componentDidMount() {
      game = new Phaser.Game({
        type: Phaser.AUTO,
        parent: "game-container",
        scale: {
          mode: Phaser.Scale.RESIZE,
          autoCenter: Phaser.Scale.CENTER_BOTH,
        },
        scene: [BootScene],
      });
  }

  getScene(key) {
    if (game && game.scene) {
      return game.scene.getScene(key);
    }
  }

  callFunctionInsideScene() {
    this.getScene("SomeGameSceneKey").doSomethingInsideTheScene();
  }

  componentWillUnmount() {
    game.destroy(true);
    game = null;
  }
}

@jdnichollsc
Copy link
Member

jdnichollsc commented Feb 12, 2021

Let me fix that during this weekend, if you are using React you can try using hooks: https://stackblitz.com/edit/react-phaser

@NilsMinor
Copy link

I am using angular and it works really well :) But I have some issues with version 3.19 and I hope that these issues are fixed in a newer version. But as ion-phaser depends on 3.19 I am not able to update. Thanks for updating @jdnichollsc 👍

@NilsMinor
Copy link

Hey :) Any updates on the ion-phaser/phaser dependency ? I do not really understand how to fix this problem by myself with adding any code to the package.json for example, so I really need you to update the dependency inside ion-phaser ^^

Thanks, Nils :)

@jdnichollsc
Copy link
Member

Let me try to do that ASAP, I need to identify what's the problem with the current configuration because Phaser is a peer dependency, very odd

@jdnichollsc
Copy link
Member

Do you know any good npm package to analyze bundle size locally?

@NilsMinor
Copy link

I never used a nom package to analyze the size but this (https://www.npmjs.com/package/webpack-bundle-analyzer) seams to do exactly what you are looking for ? :)

@Marchiuzzz
Copy link

I am using Vue and also need Phaser version of 3.50 or higher. I am a bit confused since in package.json I do have "phaser": "^3.52.0" but none of the functions which came with 3.5 work for me

@NilsMinor
Copy link

Hey @jdnichollsc sorry for bugging you :D did you came up with a solution?
Best regards,
Nils

@jdnichollsc
Copy link
Member

I'm trying to solve the issue with this peer dependency, any reaction or comment from the below issue itself is really appreciated! ionic-team/stencil#2829

@jdnichollsc
Copy link
Member

Please check the new version and let me know 👍

@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

4 participants