Jump to content

DOM frozen when resetting state


ForgeableSum
 Share

Recommended Posts

Is there anyway to perform DOM manipulation while phaser is loading or resetting a state? I noticed the DOM is completely frozen when loading/resetting a state. 

I'd like to do various DOM stuff during that time, like showing when each player in the game has completed loading. 

Link to comment
Share on other sites

Not sure how you're managing to 'freeze' the DOM, if you're performing heavy synchronous calculations during a load/reset then this will occupy the JS thread, meaning that any JS animations will cease and responding to any actions will become impossible (to solve that you'd need a scheduler, not an easy task!). If you're just loading assets then these won't block, JS is event driven so it initiates a network event to load stuff and responds to an event when it finishes.

Conceptually you just need to attach listeners to your load events i.e. you load all the assets for Player A and listen for the finished event and then you could create an image element on the page (or a sprite in a canvas) with an image you've just loaded. Pretty sure Phaser makes this trivial by exposing load events.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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