Jump to content

Angular 6 and Phaser 3?


Recommended Posts

That's actually a pretty vague question, as it's unclear what you mean by "Angular 6 with Phaser."

  • Which version of Phaser?
  • Are you using a module bundler?
  • What are you trying to do?
    • Embed a Phaser game in an Angular component?
    • Send data from Phaser to Angular?
    • Send data from Angular to Phaser?
    • Use Phaser to cause an Angular component to be rendered?
    • Angular TypeScript, or Angular Dart?

Without information, it's hard to really know what to say...

That being said, I'm assuming that you're trying to embed a Phaser game within an Angular component. You can pass a <canvas> element in your Phaser game configuration, so if your Angular template has a <canvas>, you can grab a reference to it, and then initialize Phaser.

If you download the Phaser TypeScript typings from the phaser3-docs Github repo, then you should be able to use Angular and Phaser in the same project without much hassle. You might, though, need some way to tell Angular to never update your component's state, otherwise a UI update might trigger a recreation of your canvas, and start a whole new game (though you can technically work around this and start specific game states depending on Angular's state).

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 1 year later...

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...