Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Group
Phaser.Types.GameObjects.Group

Type Definitions

GroupCallback(item)
Focus
Focus

Parameters:

name type description
item Phaser.GameObjects.GameObject

A group member

Type:
function
Focus
Focus
GroupConfig
Focus
Focus
Properties:
name type arguments Default description
classType function <optional> Sprite

Sets Phaser.GameObjects.Group#classType.

name string <optional> ''

Sets Phaser.GameObjects.Group#name.

active boolean <optional> true

Sets Phaser.GameObjects.Group#active.

maxSize number <optional> -1

Sets Phaser.GameObjects.Group#maxSize.

defaultKey string <optional> null

Sets Phaser.GameObjects.Group#defaultKey.

defaultFrame string | number <optional> null

Sets Phaser.GameObjects.Group#defaultFrame.

runChildUpdate boolean <optional> false

Sets Phaser.GameObjects.Group#runChildUpdate.

createCallback Phaser.Types.GameObjects.Group.GroupCallback <optional> null

Sets Phaser.GameObjects.Group#createCallback.

removeCallback Phaser.Types.GameObjects.Group.GroupCallback <optional> null

Sets Phaser.GameObjects.Group#removeCallback.

createMultipleCallback Phaser.Types.GameObjects.Group.GroupMultipleCreateCallback <optional> null

Sets Phaser.GameObjects.Group#createMultipleCallback.

Type:
object
Since: 3.0.0
Focus
Focus
GroupCreateConfig
Focus
Focus

Description:

The total number of objects created will be

key.length * frame.length * frameQuantity * (yoyo ? 2 : 1) * (1 + repeat)

If max is nonzero, then the total created will not exceed max.

key is required. Phaser.GameObjects.Group#defaultKey is not used.

Properties:
name type arguments Default description
classType function <optional>

The class of each new Game Object.

key string | Array.<string> <optional>

The texture key of each new Game Object.

frame string | Array.<string> | number | Array.<number> <optional> null

The texture frame of each new Game Object.

quantity number <optional> false

The number of Game Objects to create. If set, this overrides the frameQuantity value. Use frameQuantity for more advanced control.

visible boolean <optional> true

The visible state of each new Game Object.

active boolean <optional> true

The active state of each new Game Object.

repeat number <optional> 0

The number of times each key × frame combination will be repeated (after the first combination).

randomKey boolean <optional> false

Select a key at random.

randomFrame boolean <optional> false

Select a frame at random.

yoyo boolean <optional> false

Select keys and frames by moving forward then backward through key and frame.

frameQuantity number <optional> 1

The number of times each frame should be combined with one key.

max number <optional> 0

The maximum number of new Game Objects to create. 0 is no maximum.

setXY object <optional>
setXY.x number <optional> 0

The horizontal position of each new Game Object.

setXY.y number <optional> 0

The vertical position of each new Game Object.

setXY.stepX number <optional> 0

Increment each Game Object's horizontal position from the previous by this amount, starting from setXY.x.

setXY.stepY number <optional> 0

Increment each Game Object's vertical position from the previous by this amount, starting from setXY.y.

setRotation object <optional>
setRotation.value number <optional> 0

Rotation of each new Game Object.

setRotation.step number <optional> 0

Increment each Game Object's rotation from the previous by this amount, starting at setRotation.value.

setScale object <optional>
setScale.x number <optional> 0

The horizontal scale of each new Game Object.

setScale.y number <optional> 0

The vertical scale of each new Game Object.

setScale.stepX number <optional> 0

Increment each Game Object's horizontal scale from the previous by this amount, starting from setScale.x.

setScale.stepY number <optional> 0

Increment each Game object's vertical scale from the previous by this amount, starting from setScale.y.

setOrigin object <optional>
setOrigin.x number <optional> 0

The horizontal origin of each new Game Object.

setOrigin.y number <optional> 0

The vertical origin of each new Game Object.

setOrigin.stepX number <optional> 0

Increment each Game Object's horizontal origin from the previous by this amount, starting from setOrigin.x.

setOrigin.stepY number <optional> 0

Increment each Game object's vertical origin from the previous by this amount, starting from setOrigin.y.

setAlpha object <optional>
setAlpha.value number <optional> 0

The alpha value of each new Game Object.

setAlpha.step number <optional> 0

Increment each Game Object's alpha from the previous by this amount, starting from setAlpha.value.

setDepth object <optional>
setDepth.value number <optional> 0

The depth value of each new Game Object.

setDepth.step number <optional> 0

Increment each Game Object's depth from the previous by this amount, starting from setDepth.value.

setScrollFactor object <optional>
setScrollFactor.x number <optional> 0

The horizontal scroll factor of each new Game Object.

setScrollFactor.y number <optional> 0

The vertical scroll factor of each new Game Object.

setScrollFactor.stepX number <optional> 0

Increment each Game Object's horizontal scroll factor from the previous by this amount, starting from setScrollFactor.x.

setScrollFactor.stepY number <optional> 0

Increment each Game object's vertical scroll factor from the previous by this amount, starting from setScrollFactor.y.

hitArea * <optional>

A geometric shape that defines the hit area for the Game Object.

hitAreaCallback Phaser.Types.Input.HitAreaCallback <optional>

A callback to be invoked when the Game Object is interacted with.

gridAlign false | Phaser.Types.Actions.GridAlignConfig <optional> false

Align the new Game Objects in a grid using these settings.

Type:
object
Focus
Focus
GroupMultipleCreateCallback(items)
Focus
Focus

Parameters:

name type description
items Array.<Phaser.GameObjects.GameObject>

The newly created group members

Type:
function
Focus
Focus