Extended group, no update of children

Hi,

I use this extended group :

class PlayerMachinegun extends Phaser.Physics.Arcade.Group {
  
  constructor (world, scene, config) {
    
    super(world, scene, config);
    this.delay = 83;
    this.nextShot = 0;
  }
}

I use it this way, pooling bullets (extended sprites) :

playerMg = new PlayerMachinegun (
      this.physics.world,
      this,
      {classType: Bullet,
      defaultKey: 'bullet',
      maxSize: 50,
      runChildUpdate: true}
    );
    
    playerMg.createMultiple({
      active: false,
      visible: false,
      key: playerMg.defaultKey,
      repeat: playerMg.maxSize - 1,
    });

My problem : I can fire bullets, they move, overlap, play an animation, but their update method is not executed. Everything’s fine when I use a non-extended group.

I tried to add my group with this.physics.add.existing like I do with extended sprites, but it didn’t work : no sprite overlapped anymore, including sprites from non-extended groups. :thinking:

Do you think the sprites are not in the scene’s update list ? If so, how to add them correctly ?

Thanks !

Probably you need

this.add.existing(playerMg);

It’s the group that needs to be on the update list (for runChildUpdate).

It works ! Thank you @samme.