Jump to content

Child group update function does not get called


hellspawn_bg
 Share

Recommended Posts

I have a parent group that contains several child groups. Apparently only the update function of the parent group get's called. I would also like to call the update function of the childs. Is there a direct way to solve this, without iterating through the childs and manually calling update()?

 

Thanks :)

Link to comment
Share on other sites

Phaser definitely calls the child update functions:

https://github.com/photonstorm/phaser/blob/master/src/core/Group.js#L1175

This can happen if you subclass Phaser.Group but forget to call the parent function when you are overriding methods:
 

function MyGroup() {    Phaser.Group.apply(this, arguments);}MyGroup.prototype = Object.create(Phaser.Group.prototype);MyGroup.prototype.constructor = MyGroup;// if you override, make sure to call the parent function.MyGroup.prototype.update = function () {    Phaser.Group.prototype.update.apply(this, arguments);};
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...