Jump to content

Phaser + DOM


glebk
 Share

Recommended Posts

I want to implement the game with strong UI in the basis (lots of menus, scrolls, etc) but basically with the one game scene. 
As I see everybody suggests implement UI in the DOM instead of the Phaser itself for this case.  

But now I am confused how to make good architechture design of such thing. 

1. I need to track events from UI to Phaser and vice versa. What will be the right way to do it? May be you can recommend me some examples?

2. Should I use frameworks like React, Angular etc. and what framework would you prefer for this case? 

I work with Phaser 3 and Typescript. 

Link to comment
Share on other sites

I'm primarily an Angular developer, started messing around with phaser just recently and have been really enjoying the way the frameworks complement each other.

1. When extending a Phaser object to create your own object, you can add an Angular EventEmitter (or emitters) as a way to communicate between the frameworks. Phaser objects in turn can be passed in as inputs to an Angular component - or you can create an Angular Service for your Phaser.Game object and inject that service into components that need it. I'm not quite sure of the best method yet, but the patterns I've been experimenting with have been very encouraging so far.

2. Obviously I think that frameworks are a great way to go. Angular conferences often talk about integrating with JS game engines; this one calls out Phaser specifically:

 

Link to comment
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...
 Share

  • Recently Browsing   0 members

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