Sign in to follow this  
drunkenoodle

Accessing a group while using RequireJS & Phaser

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

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.