Jump to content

sprite.group query (not working in v1 to v2 migration)


charlie_says
 Share

Recommended Posts

This is essentially a v1 to v2 migration question:

 

I have this code:

holder = game.add.group();holder.bg = holder.create(0, 0, 'bg');holder.bg.events.onInputDown.add(this.level_clicked, this);

then later

level_clicked: function(bg){var holder = bg.group;...

this was working in v1, but fails in v2.

 

I guess I could set a variable myself - but is this information now stored elsewhere?

 

Link to comment
Share on other sites

Have you enabled holder.bg for input?

holder.bg.inputEnabled = true;

This was on by default in v1, and is off by default in v2.

 

Also be careful with the approach you're using. Basically you are creating a new property ('bg') on the holder Group, so just make sure you don't name your property the same as any of the methods of properties a Group actually really has and needs! Otherwise there is no telling what may happen.

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...