Skip to content

Arcade Physics group create from array config result is incorrect #6519

@samme

Description

@samme

Version

  • Phaser Version: 3.60.0

Description

If you pass an array of config objects as the children argument to add.physics.group() or new Phaser.Physics.Arcade.Group(), only the first config is used.

Example Test Code

Compare

this.add.group([
    { key: 'veg', frame: 0, setXY: { x: 0, y: 0 } },
    { key: 'veg', frame: 1, setXY: { x: 0, y: 32 } },
    { key: 'veg', frame: 2, setXY: { x: 0, y: 64 } },
]); // -> 3 sprites are created

and

this.physics.add.group([
    { key: 'veg', frame: 0, setXY: { x: 0, y: 0 } },
    { key: 'veg', frame: 1, setXY: { x: 0, y: 32 } },
    { key: 'veg', frame: 2, setXY: { x: 0, y: 64 } },
]); // -> 1 sprite is created

Additional Information

I think the problem is in https://github.com/photonstorm/phaser/blob/9e4d0ade2bfe6c6ec9e87ab65a57d05dd1b64332/src/physics/arcade/PhysicsGroup.js#L67-L81

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions