Class: StaticGroup

Phaser.Physics.Arcade. StaticGroup

An Arcade Physics Static Group object.

All Game Objects created by or added to this Group will automatically be given static Arcade Physics bodies, if they have no body.

Its dynamic counterpart is Phaser.Physics.Arcade.Group.


new StaticGroup(world, scene [, children] [, config])

Parameters:
Name Type Argument Description
world Phaser.Physics.Arcade.World

The physics simulation.

scene Phaser.Scene

The scene this group belongs to.

children Array.<Phaser.GameObjects.GameObject> | Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig <optional>

Game Objects to add to this group; or the config argument.

config Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig <optional>

Settings for this group.

Since: 3.0.0
Source: src/physics/arcade/StaticPhysicsGroup.js (Line 14)

Extends

Members


active :boolean

Whether this group runs its Phaser.GameObjects.Group#preUpdate method (which may update any members).

Type:
  • boolean
Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 145)

children :Phaser.Structs.Set.<Phaser.GameObjects.GameObject>

Members of this group.

Type:
Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 94)

classType :function

The class to create new group members from.

Type:
  • function
Since: 3.0.0
Inherited From:
Default Value:
  • Phaser.GameObjects.Sprite
Source: src/gameobjects/group/Group.js (Line 124)

<nullable> createCallback :Phaser.Types.GameObjects.Group.GroupCallback

A function to be called when adding or creating group members.

Type:
Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 196)

<nullable> createMultipleCallback :Phaser.Types.GameObjects.Group.GroupMultipleCreateCallback

A function to be called when creating several group members at once.

Type:
Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 214)

defaultFrame :string|number

A default texture frame to use when creating new group members.

Type:
  • string | number
Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 176)

defaultKey :string

A default texture key to use when creating new group members.

This is used in Phaser.GameObjects.Group#create but not in Phaser.GameObjects.Group#createMultiple.

Type:
  • string
Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 164)

isParent :boolean

A flag identifying this object as a group.

Type:
  • boolean
Since: 3.0.0
Inherited From:
Default Value:
  • true
Source: src/gameobjects/group/Group.js (Line 103)

maxSize :number

The maximum size of this group, if used as a pool. -1 is no limit.

Type:
  • number
Since: 3.0.0
Inherited From:
Default Value:
  • -1
Source: src/gameobjects/group/Group.js (Line 154)

name :string

The name of this group. Empty by default and never populated by Phaser, this is left for developers to use.

Type:
  • string
Since: 3.18.0
Inherited From:
Default Value:
  • ''
Source: src/gameobjects/group/Group.js (Line 134)

physicsType :number

The scene this group belongs to.

Type:
  • number
Since: 3.0.0
Default Value:
  • Phaser.Physics.Arcade.STATIC_BODY
Source: src/physics/arcade/StaticPhysicsGroup.js (Line 93)

<nullable> removeCallback :Phaser.Types.GameObjects.Group.GroupCallback

A function to be called when removing group members.

Type:
Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 205)

runChildUpdate :boolean

Whether to call the update method of any members.

Type:
  • boolean
Since: 3.0.0
Inherited From:
Default Value:
  • false
Source: src/gameobjects/group/Group.js (Line 185)
See:

scene :Phaser.Scene

This scene this group belongs to.

Type:
Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 85)

type :string

A textual representation of this Game Object. Used internally by Phaser but is available for your own custom classes to populate.

Type:
  • string
Since: 3.21.0
Overrides:
Default Value:
  • 'StaticPhysicsGroup'
Source: src/physics/arcade/StaticPhysicsGroup.js (Line 105)

world :Phaser.Physics.Arcade.World

The physics simulation.

Type:
Since: 3.0.0
Source: src/physics/arcade/StaticPhysicsGroup.js (Line 84)

Methods


add(child [, addToScene])

Adds a Game Object to this group.

Calls Phaser.GameObjects.Group#createCallback.

Parameters:
Name Type Argument Default Description
child Phaser.GameObjects.GameObject

The Game Object to add.

addToScene boolean <optional>
false

Also add the Game Object to the scene.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 543)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

addListener(event, fn [, context])

Add a listener for a given event.

Parameters:
Name Type Argument Default Description
event string | symbol

The event name.

fn function

The listener function.

context * <optional>
this

The context to invoke the listener with.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 111)
Returns:

this.

Type
Phaser.Physics.Arcade.StaticGroup

addMultiple(children [, addToScene])

Adds several Game Objects to this group.

Calls Phaser.GameObjects.Group#createCallback.

Parameters:
Name Type Argument Default Description
children Array.<Phaser.GameObjects.GameObject>

The Game Objects to add.

addToScene boolean <optional>
false

Also add the Game Objects to the scene.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 592)
Returns:

This group.

Type
Phaser.Physics.Arcade.StaticGroup

angle(value [, step])

Sets the angle of each group member.

Parameters:
Name Type Argument Default Description
value number

The amount to set the angle to, in degrees.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1372)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

clear( [removeFromScene] [, destroyChild])

Removes all members of this Group and optionally removes them from the Scene and / or destroys them.

Does not call Phaser.GameObjects.Group#removeCallback.

Parameters:
Name Type Argument Default Description
removeFromScene boolean <optional>
false

Optionally remove each Group member from the Scene.

destroyChild boolean <optional>
false

Optionally call destroy on the removed Group members.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 675)
Returns:

This group.

Type
Phaser.Physics.Arcade.StaticGroup

contains(child)

Tests if a Game Object is a member of this group.

Parameters:
Name Type Description
child Phaser.GameObjects.GameObject

A Game Object.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 721)
Returns:

True if the Game Object is a member of this group.

Type
boolean

countActive( [value])

Counts the number of active (or inactive) group members.

Parameters:
Name Type Argument Default Description
value boolean <optional>
true

Count active (true) or inactive (false) group members.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1102)
Returns:

The number of group members with an active state matching the active argument.

Type
number

create( [x] [, y] [, key] [, frame] [, visible] [, active])

Creates a new Game Object and adds it to this group, unless the group is full.

Calls Phaser.GameObjects.Group#createCallback.

Parameters:
Name Type Argument Default Description
x number <optional>
0

The horizontal position of the new Game Object in the world.

y number <optional>
0

The vertical position of the new Game Object in the world.

key string <optional>
defaultKey

The texture key of the new Game Object.

frame string | number <optional>
defaultFrame

The texture frame of the new Game Object.

visible boolean <optional>
true

The Phaser.GameObjects.Components.Visible#visible state of the new Game Object.

active boolean <optional>
true

The Phaser.GameObjects.GameObject#active state of the new Game Object.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 268)
Returns:

The new Game Object (usually a Sprite, etc.).

Type
any

createCallbackHandler(child)

Adds a static physics body to the new group member (if it lacks one) and adds it to the simulation.

Parameters:
Name Type Description
child Phaser.GameObjects.GameObject

The new group member.

Since: 3.0.0
Source: src/physics/arcade/StaticPhysicsGroup.js (Line 117)
See:

createFromConfig(options)

Parameters:
Name Type Description
options Phaser.Types.GameObjects.Group.GroupCreateConfig

Creation settings.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 358)
Returns:

The newly created Game Objects.

Type
Array.<any>

createMultiple(config)

Creates several Game Objects and adds them to this group.

If the group becomes Phaser.GameObjects.Group#isFull, no further Game Objects are created.

Calls Phaser.GameObjects.Group#createMultipleCallback and Phaser.GameObjects.Group#createCallback.

Parameters:
Name Type Description
config Phaser.Types.GameObjects.Group.GroupCreateConfig | Array.<Phaser.Types.GameObjects.Group.GroupCreateConfig>

Creation settings. This can be a single configuration object or an array of such objects, which will be applied in turn.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 317)
Returns:

The newly created Game Objects.

Type
Array.<any>

createMultipleCallbackHandler(entries)

Refreshes the group.

Parameters:
Name Type Description
entries Array.<Phaser.GameObjects.GameObject>

The newly created group members.

Since: 3.0.0
Source: src/physics/arcade/StaticPhysicsGroup.js (Line 153)
See:

destroy( [destroyChildren])

Empties this group and removes it from the Scene.

Does not call Phaser.GameObjects.Group#removeCallback.

Parameters:
Name Type Argument Default Description
destroyChildren boolean <optional>
false

Also Phaser.GameObjects.GameObject#destroy each group member.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1694)

emit(event [, args])

Calls each of the listeners registered for a given event.

Parameters:
Name Type Argument Description
event string | symbol

The event name.

args * <optional>
<repeatable>

Additional arguments that will be passed to the event handler.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 86)
Returns:

true if the event had listeners, else false.

Type
boolean

eventNames()

Return an array listing the events for which the emitter has registered listeners.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 55)
Returns:
Type
Array.<(string|symbol)>

get( [x] [, y] [, key] [, frame] [, visible])

Scans the group for the first member that has an Phaser.GameObjects.GameObject#active state set to false, assigns x and y, and returns the member.

If no inactive member is found and the group isn't full then it will create a new Game Object using x, y, key, frame, and visible. The new Game Object will have its active state set to true. Unless a new member is created, key, frame, and visible are ignored.

Parameters:
Name Type Argument Default Description
x number <optional>

The horizontal position of the Game Object in the world.

y number <optional>

The vertical position of the Game Object in the world.

key string <optional>
defaultKey

The texture key assigned to a new Game Object (if one is created).

frame string | number <optional>
defaultFrame

A texture frame assigned to a new Game Object (if one is created).

visible boolean <optional>
true

The Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created).

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 991)
Returns:

The first inactive group member, or a newly created member, or null.

Type
any

getChildren()

All members of the group.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 736)
Returns:

The group members.

Type
Array.<Phaser.GameObjects.GameObject>

getFirst( [state] [, createIfNull] [, x] [, y] [, key] [, frame] [, visible])

Scans the Group, from top to bottom, for the first member that has an Phaser.GameObjects.GameObject#active state matching the argument, assigns x and y, and returns the member.

If no matching member is found and createIfNull is true and the group isn't full then it will create a new Game Object using x, y, key, frame, and visible. Unless a new member is created, key, frame, and visible are ignored.

Parameters:
Name Type Argument Default Description
state boolean <optional>
false

The Phaser.GameObjects.GameObject#active value to match.

createIfNull boolean <optional>
false

Create a new Game Object if no matching members are found, using the following arguments.

x number <optional>

The horizontal position of the Game Object in the world.

y number <optional>

The vertical position of the Game Object in the world.

key string <optional>
defaultKey

The texture key assigned to a new Game Object (if one is created).

frame string | number <optional>
defaultFrame

A texture frame assigned to a new Game Object (if one is created).

visible boolean <optional>
true

The Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created).

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 786)
Returns:

The first matching group member, or a newly created member, or null.

Type
any

getFirstAlive( [createIfNull] [, x] [, y] [, key] [, frame] [, visible])

Scans the group for the first member that has an Phaser.GameObjects.GameObject#active state set to true, assigns x and y, and returns the member.

If no active member is found and createIfNull is true and the group isn't full then it will create a new one using x, y, key, frame, and visible. Unless a new member is created, key, frame, and visible are ignored.

Parameters:
Name Type Argument Default Description
createIfNull boolean <optional>
false

Create a new Game Object if no matching members are found, using the following arguments.

x number <optional>

The horizontal position of the Game Object in the world.

y number <optional>

The vertical position of the Game Object in the world.

key string <optional>
defaultKey

The texture key assigned to a new Game Object (if one is created).

frame string | number <optional>
defaultFrame

A texture frame assigned to a new Game Object (if one is created).

visible boolean <optional>
true

The Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created).

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1015)
Returns:

The first active group member, or a newly created member, or null.

Type
any

getFirstDead( [createIfNull] [, x] [, y] [, key] [, frame] [, visible])

Scans the group for the first member that has an Phaser.GameObjects.GameObject#active state set to false, assigns x and y, and returns the member.

If no inactive member is found and createIfNull is true and the group isn't full then it will create a new one using x, y, key, frame, and visible. The new Game Object will have an active state set to true. Unless a new member is created, key, frame, and visible are ignored.

Parameters:
Name Type Argument Default Description
createIfNull boolean <optional>
false

Create a new Game Object if no matching members are found, using the following arguments.

x number <optional>

The horizontal position of the Game Object in the world.

y number <optional>

The vertical position of the Game Object in the world.

key string <optional>
defaultKey

The texture key assigned to a new Game Object (if one is created).

frame string | number <optional>
defaultFrame

A texture frame assigned to a new Game Object (if one is created).

visible boolean <optional>
true

The Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created).

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1039)
Returns:

The first inactive group member, or a newly created member, or null.

Type
any

getFirstNth(nth [, state] [, createIfNull] [, x] [, y] [, key] [, frame] [, visible])

Scans the Group, from top to bottom, for the nth member that has an Phaser.GameObjects.GameObject#active state matching the argument, assigns x and y, and returns the member.

If no matching member is found and createIfNull is true and the group isn't full then it will create a new Game Object using x, y, key, frame, and visible. Unless a new member is created, key, frame, and visible are ignored.

Parameters:
Name Type Argument Default Description
nth number

The nth matching Group member to search for.

state boolean <optional>
false

The Phaser.GameObjects.GameObject#active value to match.

createIfNull boolean <optional>
false

Create a new Game Object if no matching members are found, using the following arguments.

x number <optional>

The horizontal position of the Game Object in the world.

y number <optional>

The vertical position of the Game Object in the world.

key string <optional>
defaultKey

The texture key assigned to a new Game Object (if one is created).

frame string | number <optional>
defaultFrame

A texture frame assigned to a new Game Object (if one is created).

visible boolean <optional>
true

The Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created).

Since: 3.6.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 811)
Returns:

The first matching group member, or a newly created member, or null.

Type
any

getLast( [state] [, createIfNull] [, x] [, y] [, key] [, frame] [, visible])

Scans the Group for the last member that has an Phaser.GameObjects.GameObject#active state matching the argument, assigns x and y, and returns the member.

If no matching member is found and createIfNull is true and the group isn't full then it will create a new Game Object using x, y, key, frame, and visible. Unless a new member is created, key, frame, and visible are ignored.

Parameters:
Name Type Argument Default Description
state boolean <optional>
false

The Phaser.GameObjects.GameObject#active value to match.

createIfNull boolean <optional>
false

Create a new Game Object if no matching members are found, using the following arguments.

x number <optional>

The horizontal position of the Game Object in the world.

y number <optional>

The vertical position of the Game Object in the world.

key string <optional>
defaultKey

The texture key assigned to a new Game Object (if one is created).

frame string | number <optional>
defaultFrame

A texture frame assigned to a new Game Object (if one is created).

visible boolean <optional>
true

The Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created).

Since: 3.6.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 837)
Returns:

The first matching group member, or a newly created member, or null.

Type
any

getLastNth(nth [, state] [, createIfNull] [, x] [, y] [, key] [, frame] [, visible])

Scans the Group for the last nth member that has an Phaser.GameObjects.GameObject#active state matching the argument, assigns x and y, and returns the member.

If no matching member is found and createIfNull is true and the group isn't full then it will create a new Game Object using x, y, key, frame, and visible. Unless a new member is created, key, frame, and visible are ignored.

Parameters:
Name Type Argument Default Description
nth number

The nth matching Group member to search for.

state boolean <optional>
false

The Phaser.GameObjects.GameObject#active value to match.

createIfNull boolean <optional>
false

Create a new Game Object if no matching members are found, using the following arguments.

x number <optional>

The horizontal position of the Game Object in the world.

y number <optional>

The vertical position of the Game Object in the world.

key string <optional>
defaultKey

The texture key assigned to a new Game Object (if one is created).

frame string | number <optional>
defaultFrame

A texture frame assigned to a new Game Object (if one is created).

visible boolean <optional>
true

The Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created).

Since: 3.6.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 862)
Returns:

The first matching group member, or a newly created member, or null.

Type
any

getLength()

The number of members of the group.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 749)
Returns:
Type
number

getMatching( [property] [, value] [, startIndex] [, endIndex])

Returns all children in this Group that match the given criteria based on the property and value arguments.

For example: getAll('visible', true) would return only children that have their visible property set.

Optionally, you can specify a start and end index. For example if the Group has 100 elements, and you set startIndex to 0 and endIndex to 50, it would return matches from only the first 50.

Parameters:
Name Type Argument Description
property string <optional>

The property to test on each array element.

value * <optional>

The value to test the property against. Must pass a strict (===) comparison check.

startIndex number <optional>

An optional start index to search from.

endIndex number <optional>

An optional end index to search to.

Since: 3.50.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 762)
Returns:

An array of matching Group members. The array will be empty if nothing matched.

Type
Array.<any>

getTotalFree()

The difference of Phaser.GameObjects.Group#maxSize and the number of active group members.

This represents the number of group members that could be created or reactivated before reaching the size limit.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1142)
Returns:

maxSize minus the number of active group numbers; or a large number (if maxSize is -1).

Type
number

getTotalUsed()

Counts the number of in-use (active) group members.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1129)
Returns:

The number of group members with an active state of true.

Type
number

incX(value [, step])

Adds the given value to the x of each group member.

Parameters:
Name Type Argument Default Description
value number

The amount to be added to the x property.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1294)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

incXY(x [, y] [, stepX] [, stepY])

Adds the given value to the x, y of each group member.

Parameters:
Name Type Argument Default Description
x number

The amount to be added to the x property.

y number <optional>
x

The amount to be added to the y property. If undefined or null it uses the x value.

stepX number <optional>
0

This is added to the x amount, multiplied by the iteration counter.

stepY number <optional>
0

This is added to the y amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1330)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

incY(value [, step])

Adds the given value to the y of each group member.

Parameters:
Name Type Argument Default Description
value number

The amount to be added to the y property.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1312)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

isFull()

Whether this group's size at its maximum.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1082)
Returns:

True if the number of members equals Phaser.GameObjects.Group#maxSize.

Type
boolean

kill(gameObject)

Deactivates a member of this group.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

A member of this group.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1627)

killAndHide(gameObject)

Deactivates and hides a member of this group.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

A member of this group.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1643)

listenerCount(event)

Return the number of listeners listening to a given event.

Parameters:
Name Type Description
event string | symbol

The event name.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 75)
Returns:

The number of listeners.

Type
number

listeners(event)

Return the listeners registered for a given event.

Parameters:
Name Type Description
event string | symbol

The event name.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 64)
Returns:

The registered listeners.

Type
Array.<function()>

off(event [, fn] [, context] [, once])

Remove the listeners of a given event.

Parameters:
Name Type Argument Description
event string | symbol

The event name.

fn function <optional>

Only remove the listeners that match this function.

context * <optional>

Only remove the listeners that have this context.

once boolean <optional>

Only remove one-time listeners.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 151)
Returns:

this.

Type
Phaser.Physics.Arcade.StaticGroup

on(event, fn [, context])

Add a listener for a given event.

Parameters:
Name Type Argument Default Description
event string | symbol

The event name.

fn function

The listener function.

context * <optional>
this

The context to invoke the listener with.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 98)
Returns:

this.

Type
Phaser.Physics.Arcade.StaticGroup

once(event, fn [, context])

Add a one-time listener for a given event.

Parameters:
Name Type Argument Default Description
event string | symbol

The event name.

fn function

The listener function.

context * <optional>
this

The context to invoke the listener with.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 124)
Returns:

this.

Type
Phaser.Physics.Arcade.StaticGroup

playAnimation(key [, startFrame])

Plays an animation for all members of this group.

Parameters:
Name Type Argument Default Description
key string

The string-based key of the animation to play.

startFrame string <optional>
0

Optionally start the animation playing from this frame index.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1064)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

preUpdate(time, delta)

Updates any group members, if Phaser.GameObjects.Group#runChildUpdate is enabled.

Parameters:
Name Type Description
time number

The current timestamp.

delta number

The delta time elapsed since the last frame.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 513)

propertyValueInc(key, value [, step] [, index] [, direction])

Adds the given value to the property as defined in key of each group member.

Parameters:
Name Type Argument Default Description
key string

The property to be updated.

value number

The amount to set the property to.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

index number <optional>
0

An optional offset to start searching from within the items array.

direction number <optional>
1

The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1217)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

propertyValueSet(key, value [, step] [, index] [, direction])

Sets the property as defined in key of each group member to the given value.

Parameters:
Name Type Argument Default Description
key string

The property to be updated.

value number

The amount to set the property to.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

index number <optional>
0

An optional offset to start searching from within the items array.

direction number <optional>
1

The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1196)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

refresh()

Resets each Body to the position of its parent Game Object. Body sizes aren't changed (use Phaser.Physics.Arcade.Components.Enable#refreshBody for that).

Since: 3.0.0
Source: src/physics/arcade/StaticPhysicsGroup.js (Line 168)
See:
Returns:

This group.

Type
Phaser.Physics.Arcade.StaticGroup

remove(child [, removeFromScene] [, destroyChild])

Removes a member of this Group and optionally removes it from the Scene and / or destroys it.

Calls Phaser.GameObjects.Group#removeCallback.

Parameters:
Name Type Argument Default Description
child Phaser.GameObjects.GameObject

The Game Object to remove.

removeFromScene boolean <optional>
false

Optionally remove the Group member from the Scene it belongs to.

destroyChild boolean <optional>
false

Optionally call destroy on the removed Group member.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 620)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

removeAllListeners( [event])

Remove all listeners, or those of the specified event.

Parameters:
Name Type Argument Description
event string | symbol <optional>

The event name.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 165)
Returns:

this.

Type
Phaser.Physics.Arcade.StaticGroup

removeCallbackHandler(child)

Disables the group member's physics body, removing it from the simulation.

Parameters:
Name Type Description
child Phaser.GameObjects.GameObject

The group member being removed.

Since: 3.0.0
Source: src/physics/arcade/StaticPhysicsGroup.js (Line 135)
See:

removeListener(event [, fn] [, context] [, once])

Remove the listeners of a given event.

Parameters:
Name Type Argument Description
event string | symbol

The event name.

fn function <optional>

Only remove the listeners that match this function.

context * <optional>

Only remove the listeners that have this context.

once boolean <optional>

Only remove one-time listeners.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 137)
Returns:

this.

Type
Phaser.Physics.Arcade.StaticGroup

rotate(value [, step])

Sets the rotation of each group member.

Parameters:
Name Type Argument Default Description
value number

The amount to set the rotation to, in radians.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1390)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

rotateAround(point, angle)

Rotates each group member around the given point by the given angle.

Parameters:
Name Type Description
point Phaser.Types.Math.Vector2Like

Any object with public x and y properties.

angle number

The angle to rotate by, in radians.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1408)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

rotateAroundDistance(point, angle, distance)

Rotates each group member around the given point by the given angle and distance.

Parameters:
Name Type Description
point Phaser.Types.Math.Vector2Like

Any object with public x and y properties.

angle number

The angle to rotate by, in radians.

distance number

The distance from the point of rotation in pixels.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1426)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

scaleX(value [, step])

Sets the scaleX of each group member.

Parameters:
Name Type Argument Default Description
value number

The amount to set the property to.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1503)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

scaleXY(scaleX [, scaleY] [, stepX] [, stepY])

Sets the scaleX, scaleY of each group member.

Parameters:
Name Type Argument Default Description
scaleX number

The amount to be added to the scaleX property.

scaleY number <optional>

The amount to be added to the scaleY property. If undefined or null it uses the scaleX value.

stepX number <optional>
0

This is added to the scaleX amount, multiplied by the iteration counter.

stepY number <optional>
0

This is added to the scaleY amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1539)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

scaleY(value [, step])

Sets the scaleY of each group member.

Parameters:
Name Type Argument Default Description
value number

The amount to set the property to.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1521)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setActive(value)

Sets the active property of this Group. When active, this Group runs its preUpdate method.

Parameters:
Name Type Description
value boolean

True if this Group should be set as active, false if not.

Since: 3.24.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1160)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setAlpha(value [, step])

Sets the alpha of each group member.

Parameters:
Name Type Argument Default Description
value number

The amount to set the alpha to.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1445)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setBlendMode(value)

Sets the blendMode of each group member.

Parameters:
Name Type Description
value number

The amount to set the property to.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1577)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setDepth(value [, step])

Sets the depth of each group member.

Parameters:
Name Type Argument Default Description
value number

The amount to set the property to.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1559)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setHitArea(hitArea, hitAreaCallback)

Passes all group members to the Input Manager to enable them for input with identical areas and callbacks.

Parameters:
Name Type Description
hitArea *

Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used.

hitAreaCallback Phaser.Types.Input.HitAreaCallback

A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1594)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setName(value)

Sets the name property of this Group. The name property is not populated by Phaser and is presented for your own use.

Parameters:
Name Type Description
value string

The name to be given to this Group.

Since: 3.24.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1178)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setOrigin(originX [, originY] [, stepX] [, stepY])

Sets the originX, originY of each group member.

Parameters:
Name Type Argument Default Description
originX number

The amount to set the originX property to.

originY number <optional>

The amount to set the originY property to. If undefined or null it uses the originX value.

stepX number <optional>
0

This is added to the originX amount, multiplied by the iteration counter.

stepY number <optional>
0

This is added to the originY amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1483)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setTint(topLeft [, topRight] [, bottomLeft] [, bottomRight])

Sets the tint of each group member.

Parameters:
Name Type Argument Description
topLeft number

The tint being applied to top-left corner of item. If other parameters are given no value, this tint will be applied to whole item.

topRight number <optional>

The tint to be applied to top-right corner of item.

bottomLeft number <optional>

The tint to be applied to the bottom-left corner of item.

bottomRight number <optional>

The tint to be applied to the bottom-right corner of item.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1463)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setVisible(value [, index] [, direction])

Sets the visible of each group member.

Parameters:
Name Type Argument Default Description
value boolean

The value to set the property to.

index number <optional>
0

An optional offset to start searching from within the items array.

direction number <optional>
1

The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1660)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setX(value [, step])

Sets the x of each group member.

Parameters:
Name Type Argument Default Description
value number

The amount to set the property to.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1238)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setXY(x [, y] [, stepX] [, stepY])

Sets the x, y of each group member.

Parameters:
Name Type Argument Default Description
x number

The amount to set the x property to.

y number <optional>
x

The amount to set the y property to. If undefined or null it uses the x value.

stepX number <optional>
0

This is added to the x amount, multiplied by the iteration counter.

stepY number <optional>
0

This is added to the y amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1274)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

setY(value [, step])

Sets the y of each group member.

Parameters:
Name Type Argument Default Description
value number

The amount to set the property to.

step number <optional>
0

This is added to the value amount, multiplied by the iteration counter.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1256)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

shiftPosition(x, y [, direction])

Iterate through the group members changing the position of each element to be that of the element that came before it in the array (or after it if direction = 1)

The first group member position is set to x/y.

Parameters:
Name Type Argument Default Description
x number

The x coordinate to place the first item in the array at.

y number

The y coordinate to place the first item in the array at.

direction number <optional>
0

The iteration direction. 0 = first to last and 1 = last to first.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1350)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

shuffle()

Shuffles the group members in place.

Since: 3.21.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1612)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup

shutdown()

Removes all listeners.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 31)

toggleVisible()

Toggles (flips) the visible state of each member of this group.

Since: 3.0.0
Inherited From:
Source: src/gameobjects/group/Group.js (Line 1679)
Returns:

This Group object.

Type
Phaser.Physics.Arcade.StaticGroup