Skip to content

Add x, y options to Group createMultiple()#7265

Open
samme wants to merge 1 commit intophaserjs:v4.0.0from
samme:feature/v4.0.0/createMultiple-xy
Open

Add x, y options to Group createMultiple()#7265
samme wants to merge 1 commit intophaserjs:v4.0.0from
samme:feature/v4.0.0/createMultiple-xy

Conversation

@samme
Copy link
Contributor

@samme samme commented Mar 17, 2026

This PR

  • Adds a new feature

Adds x and y options to Group#createMultiple(). Values per GetAdvancedValue().

Examples

this.group.createMultiple({
    // …
    x: 100,
    y: 100
});

this.group.createMultiple({
    // …
    x: { randInt: [0, 800] },
    y: { randInt: [0, 600] },
});

this.group.createMultiple({
    // …
    x: [100, 200, 300, 400],
    y: [500, 600]
});

this.group.createMultiple({
    // …
    x: () => Phaser.Math.RND.weightedPick(X),
    y: () => Phaser.Math.RND.weightedPick(Y)
});

Note

Low Risk
Low risk, small additive change to Group#createFromConfig that only affects initial positions of newly created objects when x/y are provided; existing setXY behavior remains unchanged.

Overview
Adds support for per-object initial positioning in Group#createMultiple(). createFromConfig now reads x and y from the creation config via GetAdvancedValue and passes them into Group#create, enabling fixed, array-driven, or dynamic/randomized coordinates at creation time.

Updates the GroupCreateConfig typedef to document the new x/y options and their supported value types.

Written by Cursor Bugbot for commit 7f41624. This will update automatically on new commits. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant