Jump to content

Phase.Game() states


rpiller
 Share

Recommended Posts

So all the examples I'm seeing create the game like:

 

var game = new Phaser.Game(w, h, Phaser.Auto, 'game', { preload: preload, create: create, update: update });

 

 

However, I'm using SignalR to make a multiplayer game and this doesn't seem to fit well with my needs. I make the connection to the server via SignalR first, and then once that's made I'll request the tilesets and map data from the server that I would normally do in preload/create (because the map is 100% dynamic). I assume I can call preload() and create() on my own which is fine for the setup, but how would I start the game loop then so update/render start getting called?

Link to comment
Share on other sites

OK, I got the flow figure out. I didn't create the Phaser.Game until the client loaded the image information from server callbacks and I assigned them to global variables. Then after all that is stored in variables I create the Phaser.Game and all good.

Link to comment
Share on other sites

OK, so I'm looking at the template and it seems like Phaser injects some variables and calls some functions of my "class" (create/preload/update).

 

What's the difference between create & preload? Normally states have one for transition in and one for transition out. Phaser seems to have 2 for transition in and none for transition out. Why is that?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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