Depansho

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).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.