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 |
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.
Parameters:
Name Type Argument Default Description childPhaser.GameObjects.GameObject The Game Object to add.
addToSceneboolean <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.
-
addListener(event, fn [, context])
-
Add a listener for a given event.
Parameters:
Name Type Argument Default Description eventstring | symbol The event name.
fnfunction 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. -
addMultiple(children [, addToScene])
-
Adds several Game Objects to this group.
Parameters:
Name Type Argument Default Description childrenArray.<Phaser.GameObjects.GameObject> The Game Objects to add.
addToSceneboolean <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.
-
angle(value [, step])
-
Sets the angle of each group member.
Parameters:
Name Type Argument Default Description valuenumber The amount to set the angle to, in degrees.
stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1372)
Returns:
This Group object.
-
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 removeFromSceneboolean <optional>
false Optionally remove each Group member from the Scene.
destroyChildboolean <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.
-
contains(child)
-
Tests if a Game Object is a member of this group.
Parameters:
Name Type Description childPhaser.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 valueboolean <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
activeargument.- 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.
Parameters:
Name Type Argument Default Description xnumber <optional>
0 The horizontal position of the new Game Object in the world.
ynumber <optional>
0 The vertical position of the new Game Object in the world.
keystring <optional>
defaultKey The texture key of the new Game Object.
framestring | number <optional>
defaultFrame The texture frame of the new Game Object.
visibleboolean <optional>
true The Phaser.GameObjects.Components.Visible#visible state of the new Game Object.
activeboolean <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 childPhaser.GameObjects.GameObject The new group member.
- Since: 3.0.0
- Source: src/physics/arcade/StaticPhysicsGroup.js (Line 117)
- See:
-
createFromConfig(options)
-
A helper for Phaser.GameObjects.Group#createMultiple.
Parameters:
Name Type Description optionsPhaser.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 configPhaser.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 entriesArray.<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 destroyChildrenboolean <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 eventstring | 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:
trueif the event had listeners, elsefalse.- 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, assignsxandy, 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, andvisible. The new Game Object will have its active state set totrue. Unless a new member is created,key,frame, andvisibleare ignored.Parameters:
Name Type Argument Default Description xnumber <optional>
The horizontal position of the Game Object in the world.
ynumber <optional>
The vertical position of the Game Object in the world.
keystring <optional>
defaultKey The texture key assigned to a new Game Object (if one is created).
framestring | number <optional>
defaultFrame A texture frame assigned to a new Game Object (if one is created).
visibleboolean <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
xandy, and returns the member.If no matching member is found and
createIfNullis true and the group isn't full then it will create a new Game Object usingx,y,key,frame, andvisible. Unless a new member is created,key,frame, andvisibleare ignored.Parameters:
Name Type Argument Default Description stateboolean <optional>
false The Phaser.GameObjects.GameObject#active value to match.
createIfNullboolean <optional>
false Create a new Game Object if no matching members are found, using the following arguments.
xnumber <optional>
The horizontal position of the Game Object in the world.
ynumber <optional>
The vertical position of the Game Object in the world.
keystring <optional>
defaultKey The texture key assigned to a new Game Object (if one is created).
framestring | number <optional>
defaultFrame A texture frame assigned to a new Game Object (if one is created).
visibleboolean <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, assignsxandy, and returns the member.If no active member is found and
createIfNullistrueand the group isn't full then it will create a new one usingx,y,key,frame, andvisible. Unless a new member is created,key,frame, andvisibleare ignored.Parameters:
Name Type Argument Default Description createIfNullboolean <optional>
false Create a new Game Object if no matching members are found, using the following arguments.
xnumber <optional>
The horizontal position of the Game Object in the world.
ynumber <optional>
The vertical position of the Game Object in the world.
keystring <optional>
defaultKey The texture key assigned to a new Game Object (if one is created).
framestring | number <optional>
defaultFrame A texture frame assigned to a new Game Object (if one is created).
visibleboolean <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, assignsxandy, and returns the member.If no inactive member is found and
createIfNullistrueand the group isn't full then it will create a new one usingx,y,key,frame, andvisible. The new Game Object will have an active state set totrue. Unless a new member is created,key,frame, andvisibleare ignored.Parameters:
Name Type Argument Default Description createIfNullboolean <optional>
false Create a new Game Object if no matching members are found, using the following arguments.
xnumber <optional>
The horizontal position of the Game Object in the world.
ynumber <optional>
The vertical position of the Game Object in the world.
keystring <optional>
defaultKey The texture key assigned to a new Game Object (if one is created).
framestring | number <optional>
defaultFrame A texture frame assigned to a new Game Object (if one is created).
visibleboolean <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
xandy, and returns the member.If no matching member is found and
createIfNullis true and the group isn't full then it will create a new Game Object usingx,y,key,frame, andvisible. Unless a new member is created,key,frame, andvisibleare ignored.Parameters:
Name Type Argument Default Description nthnumber The nth matching Group member to search for.
stateboolean <optional>
false The Phaser.GameObjects.GameObject#active value to match.
createIfNullboolean <optional>
false Create a new Game Object if no matching members are found, using the following arguments.
xnumber <optional>
The horizontal position of the Game Object in the world.
ynumber <optional>
The vertical position of the Game Object in the world.
keystring <optional>
defaultKey The texture key assigned to a new Game Object (if one is created).
framestring | number <optional>
defaultFrame A texture frame assigned to a new Game Object (if one is created).
visibleboolean <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
xandy, and returns the member.If no matching member is found and
createIfNullis true and the group isn't full then it will create a new Game Object usingx,y,key,frame, andvisible. Unless a new member is created,key,frame, andvisibleare ignored.Parameters:
Name Type Argument Default Description stateboolean <optional>
false The Phaser.GameObjects.GameObject#active value to match.
createIfNullboolean <optional>
false Create a new Game Object if no matching members are found, using the following arguments.
xnumber <optional>
The horizontal position of the Game Object in the world.
ynumber <optional>
The vertical position of the Game Object in the world.
keystring <optional>
defaultKey The texture key assigned to a new Game Object (if one is created).
framestring | number <optional>
defaultFrame A texture frame assigned to a new Game Object (if one is created).
visibleboolean <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
xandy, and returns the member.If no matching member is found and
createIfNullis true and the group isn't full then it will create a new Game Object usingx,y,key,frame, andvisible. Unless a new member is created,key,frame, andvisibleare ignored.Parameters:
Name Type Argument Default Description nthnumber The nth matching Group member to search for.
stateboolean <optional>
false The Phaser.GameObjects.GameObject#active value to match.
createIfNullboolean <optional>
false Create a new Game Object if no matching members are found, using the following arguments.
xnumber <optional>
The horizontal position of the Game Object in the world.
ynumber <optional>
The vertical position of the Game Object in the world.
keystring <optional>
defaultKey The texture key assigned to a new Game Object (if one is created).
framestring | number <optional>
defaultFrame A texture frame assigned to a new Game Object (if one is created).
visibleboolean <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
propertyandvaluearguments.For example:
getAll('visible', true)would return only children that have theirvisibleproperty set.Optionally, you can specify a start and end index. For example if the Group has 100 elements, and you set
startIndexto 0 andendIndexto 50, it would return matches from only the first 50.Parameters:
Name Type Argument Description propertystring <optional>
The property to test on each array element.
value* <optional>
The value to test the property against. Must pass a strict (
===) comparison check.startIndexnumber <optional>
An optional start index to search from.
endIndexnumber <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 valuenumber The amount to be added to the
xproperty.stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1294)
Returns:
This Group object.
-
incXY(x [, y] [, stepX] [, stepY])
-
Adds the given value to the x, y of each group member.
Parameters:
Name Type Argument Default Description xnumber The amount to be added to the
xproperty.ynumber <optional>
x The amount to be added to the
yproperty. Ifundefinedornullit uses thexvalue.stepXnumber <optional>
0 This is added to the
xamount, multiplied by the iteration counter.stepYnumber <optional>
0 This is added to the
yamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1330)
Returns:
This Group object.
-
incY(value [, step])
-
Adds the given value to the y of each group member.
Parameters:
Name Type Argument Default Description valuenumber The amount to be added to the
yproperty.stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1312)
Returns:
This Group object.
-
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 gameObjectPhaser.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 gameObjectPhaser.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 eventstring | 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 eventstring | 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 eventstring | symbol The event name.
fnfunction <optional>
Only remove the listeners that match this function.
context* <optional>
Only remove the listeners that have this context.
onceboolean <optional>
Only remove one-time listeners.
- Since: 3.0.0
- Inherited From:
- Source: src/events/EventEmitter.js (Line 151)
Returns:
this. -
on(event, fn [, context])
-
Add a listener for a given event.
Parameters:
Name Type Argument Default Description eventstring | symbol The event name.
fnfunction 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. -
once(event, fn [, context])
-
Add a one-time listener for a given event.
Parameters:
Name Type Argument Default Description eventstring | symbol The event name.
fnfunction 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. -
playAnimation(key [, startFrame])
-
Plays an animation for all members of this group.
Parameters:
Name Type Argument Default Description keystring The string-based key of the animation to play.
startFramestring <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.
-
preUpdate(time, delta)
-
Updates any group members, if Phaser.GameObjects.Group#runChildUpdate is enabled.
Parameters:
Name Type Description timenumber The current timestamp.
deltanumber 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
keyof each group member.Parameters:
Name Type Argument Default Description keystring The property to be updated.
valuenumber The amount to set the property to.
stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.indexnumber <optional>
0 An optional offset to start searching from within the items array.
directionnumber <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.
-
propertyValueSet(key, value [, step] [, index] [, direction])
-
Sets the property as defined in
keyof each group member to the given value.Parameters:
Name Type Argument Default Description keystring The property to be updated.
valuenumber The amount to set the property to.
stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.indexnumber <optional>
0 An optional offset to start searching from within the items array.
directionnumber <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.
-
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.
-
remove(child [, removeFromScene] [, destroyChild])
-
Removes a member of this Group and optionally removes it from the Scene and / or destroys it.
Parameters:
Name Type Argument Default Description childPhaser.GameObjects.GameObject The Game Object to remove.
removeFromSceneboolean <optional>
false Optionally remove the Group member from the Scene it belongs to.
destroyChildboolean <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.
-
removeAllListeners( [event])
-
Remove all listeners, or those of the specified event.
Parameters:
Name Type Argument Description eventstring | symbol <optional>
The event name.
- Since: 3.0.0
- Inherited From:
- Source: src/events/EventEmitter.js (Line 165)
Returns:
this. -
removeCallbackHandler(child)
-
Disables the group member's physics body, removing it from the simulation.
Parameters:
Name Type Description childPhaser.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 eventstring | symbol The event name.
fnfunction <optional>
Only remove the listeners that match this function.
context* <optional>
Only remove the listeners that have this context.
onceboolean <optional>
Only remove one-time listeners.
- Since: 3.0.0
- Inherited From:
- Source: src/events/EventEmitter.js (Line 137)
Returns:
this. -
rotate(value [, step])
-
Sets the rotation of each group member.
Parameters:
Name Type Argument Default Description valuenumber The amount to set the rotation to, in radians.
stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1390)
Returns:
This Group object.
-
rotateAround(point, angle)
-
Rotates each group member around the given point by the given angle.
Parameters:
Name Type Description pointPhaser.Types.Math.Vector2Like Any object with public
xandyproperties.anglenumber 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.
-
rotateAroundDistance(point, angle, distance)
-
Rotates each group member around the given point by the given angle and distance.
Parameters:
Name Type Description pointPhaser.Types.Math.Vector2Like Any object with public
xandyproperties.anglenumber The angle to rotate by, in radians.
distancenumber 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.
-
scaleX(value [, step])
-
Sets the scaleX of each group member.
Parameters:
Name Type Argument Default Description valuenumber The amount to set the property to.
stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1503)
Returns:
This Group object.
-
scaleXY(scaleX [, scaleY] [, stepX] [, stepY])
-
Sets the scaleX, scaleY of each group member.
Parameters:
Name Type Argument Default Description scaleXnumber The amount to be added to the
scaleXproperty.scaleYnumber <optional>
The amount to be added to the
scaleYproperty. Ifundefinedornullit uses thescaleXvalue.stepXnumber <optional>
0 This is added to the
scaleXamount, multiplied by the iteration counter.stepYnumber <optional>
0 This is added to the
scaleYamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1539)
Returns:
This Group object.
-
scaleY(value [, step])
-
Sets the scaleY of each group member.
Parameters:
Name Type Argument Default Description valuenumber The amount to set the property to.
stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1521)
Returns:
This Group object.
-
setActive(value)
-
Sets the
activeproperty of this Group. When active, this Group runs itspreUpdatemethod.Parameters:
Name Type Description valueboolean 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.
-
setAlpha(value [, step])
-
Sets the alpha of each group member.
Parameters:
Name Type Argument Default Description valuenumber The amount to set the alpha to.
stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1445)
Returns:
This Group object.
-
setBlendMode(value)
-
Sets the blendMode of each group member.
Parameters:
Name Type Description valuenumber 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.
-
setDepth(value [, step])
-
Sets the depth of each group member.
Parameters:
Name Type Argument Default Description valuenumber The amount to set the property to.
stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.- Since: 3.0.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1559)
Returns:
This Group object.
-
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.
hitAreaCallbackPhaser.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.
-
setName(value)
-
Sets the
nameproperty of this Group. Thenameproperty is not populated by Phaser and is presented for your own use.Parameters:
Name Type Description valuestring 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.
-
setOrigin(originX [, originY] [, stepX] [, stepY])
-
Sets the originX, originY of each group member.
Parameters:
Name Type Argument Default Description originXnumber The amount to set the
originXproperty to.originYnumber <optional>
The amount to set the
originYproperty to. Ifundefinedornullit uses theoriginXvalue.stepXnumber <optional>
0 This is added to the
originXamount, multiplied by the iteration counter.stepYnumber <optional>
0 This is added to the
originYamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1483)
Returns:
This Group object.
-
setTint(topLeft [, topRight] [, bottomLeft] [, bottomRight])
-
Sets the tint of each group member.
Parameters:
Name Type Argument Description topLeftnumber 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.
topRightnumber <optional>
The tint to be applied to top-right corner of item.
bottomLeftnumber <optional>
The tint to be applied to the bottom-left corner of item.
bottomRightnumber <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.
-
setVisible(value [, index] [, direction])
-
Sets the visible of each group member.
Parameters:
Name Type Argument Default Description valueboolean The value to set the property to.
indexnumber <optional>
0 An optional offset to start searching from within the items array.
directionnumber <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.
-
setX(value [, step])
-
Sets the x of each group member.
Parameters:
Name Type Argument Default Description valuenumber The amount to set the property to.
stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1238)
Returns:
This Group object.
-
setXY(x [, y] [, stepX] [, stepY])
-
Sets the x, y of each group member.
Parameters:
Name Type Argument Default Description xnumber The amount to set the
xproperty to.ynumber <optional>
x The amount to set the
yproperty to. Ifundefinedornullit uses thexvalue.stepXnumber <optional>
0 This is added to the
xamount, multiplied by the iteration counter.stepYnumber <optional>
0 This is added to the
yamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1274)
Returns:
This Group object.
-
setY(value [, step])
-
Sets the y of each group member.
Parameters:
Name Type Argument Default Description valuenumber The amount to set the property to.
stepnumber <optional>
0 This is added to the
valueamount, multiplied by the iteration counter.- Since: 3.21.0
- Inherited From:
- Source: src/gameobjects/group/Group.js (Line 1256)
Returns:
This Group object.
-
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 xnumber The x coordinate to place the first item in the array at.
ynumber The y coordinate to place the first item in the array at.
directionnumber <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.
-
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.
-
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.
