Jump to content

Accessing a group while using RequireJS & Phaser


drunkenoodle
 Share

Recommended Posts

Hello everyone,

I wondered what the best course of action might be if you're using RequireJS with Phaser and wanting to access groups from other scripts. For instance, on the 'create' method (currently housed in its own script file) I have a bunch of groups that exist, but they only exist within that context, and it would be great to be able to access them say from another area that handles the game's update loop, etc.

 

Current all I'm doing is this, it does work, but I can't help but wonder that it's not a nice way of doing it:

this.game.groups = {};// And the groupsthis.game.groups.explosions = explosions;this.game.groups.damageHits = damageHits;

Have any of you guys run in to this before?

 

Many thanks,

- D

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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