The physics simulation.
The scene this group belongs to.
Optionalchildren: GameObject[] | GroupConfig | GroupCreateConfigGame Objects to add to this group; or the config argument.
Optionalconfig: GroupConfig | GroupCreateConfigSettings for this group.
Whether this group runs its Phaser.GameObjects.Group#preUpdate method (which may update any members).
Members of this group.
The class to create new group members from.
The constructor arguments must match (scene, x, y, texture, frame).
The Arcade Physics Static Group Collision Category.
This can be set to any valid collision bitfield value.
See the setCollisionCategory method for more details.
The Arcade Physics Static Group Collision Mask.
See the setCollidesWith method for more details.
A function to be called when adding or creating group members.
A function to be called when creating several group members at once.
A default texture frame to use when creating new group members.
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.
A flag identifying this object as a group.
The maximum size of this group, if used as a pool. -1 is no limit.
The name of this group. Empty by default and never populated by Phaser, this is left for developers to use.
The scene this group belongs to.
A function to be called when removing group members.
Whether to call the update method of any members.
This scene this group belongs to.
A textual representation of this Game Object. Used internally by Phaser but is available for your own custom classes to populate.
The physics simulation.
Adds a Game Object to this group.
The Game Object to add.
OptionaladdToScene: booleanAlso add the Game Object to the scene. Default false.
Adds the given Collision Category to the list of those that this Arcade Physics Body will collide with.
The collision category to add.
Add a listener for a given event.
The event name.
The listener function.
Optionalcontext: anyThe context to invoke the listener with. Default this.
Adds several Game Objects to this group.
The Game Objects to add.
OptionaladdToScene: booleanAlso add the Game Objects to the scene. Default false.
Sets the angle of each group member.
The amount to set the angle to, in degrees.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Removes all members of this Group and optionally removes them from the Scene and / or destroys them.
Does not call Phaser.GameObjects.Group#removeCallback.
OptionalremoveFromScene: booleanOptionally remove each Group member from the Scene. Default false.
OptionaldestroyChild: booleanOptionally call destroy on the removed Group members. Default false.
Tests if a Game Object is a member of this group.
A Game Object.
Counts the number of active (or inactive) group members.
Optionalvalue: booleanCount active (true) or inactive (false) group members. Default true.
Creates a new Game Object and adds it to this group, unless the group is full.
Optionalx: numberThe horizontal position of the new Game Object in the world. Default 0.
Optionaly: numberThe vertical position of the new Game Object in the world. Default 0.
Optionalkey: stringThe texture key of the new Game Object. Default defaultKey.
Optionalframe: string | numberThe texture frame of the new Game Object. Default defaultFrame.
Optionalvisible: booleanThe Phaser.GameObjects.Components.Visible#visible state of the new Game Object. Default true.
Optionalactive: booleanThe Phaser.GameObjects.GameObject#active state of the new Game Object. Default true.
Adds a static physics body to the new group member (if it lacks one) and adds it to the simulation.
The new group member.
A helper for Phaser.GameObjects.Group#createMultiple.
Creation settings.
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.
Creation settings. This can be a single configuration object or an array of such objects, which will be applied in turn.
Empties this Group of all children and removes it from the Scene.
Does not call Phaser.GameObjects.Group#removeCallback.
Children of this Group will not be removed from the Scene by calling this method
unless you specify the removeFromScene parameter.
Children of this Group will also not be destroyed by calling this method
unless you specify the destroyChildren parameter.
OptionaldestroyChildren: booleanAlso Phaser.GameObjects.GameObject#destroy each Group member. Default false.
OptionalremoveFromScene: booleanOptionally remove each Group member from the Scene. Default false.
Calls each of the listeners registered for a given event.
The event name.
Additional arguments that will be passed to the event handler.
Return an array listing the events for which the emitter has registered listeners.
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.
Optionalx: numberThe horizontal position of the Game Object in the world.
Optionaly: numberThe vertical position of the Game Object in the world.
Optionalkey: stringThe texture key assigned to a new Game Object (if one is created). Default defaultKey.
Optionalframe: string | numberA texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
Optionalvisible: booleanThe Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created). Default true.
All members of the group.
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.
Optionalstate: booleanThe Phaser.GameObjects.GameObject#active value to match. Default false.
OptionalcreateIfNull: booleanCreate a new Game Object if no matching members are found, using the following arguments. Default false.
Optionalx: numberThe horizontal position of the Game Object in the world.
Optionaly: numberThe vertical position of the Game Object in the world.
Optionalkey: stringThe texture key assigned to a new Game Object (if one is created). Default defaultKey.
Optionalframe: string | numberA texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
Optionalvisible: booleanThe Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created). Default true.
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.
OptionalcreateIfNull: booleanCreate a new Game Object if no matching members are found, using the following arguments. Default false.
Optionalx: numberThe horizontal position of the Game Object in the world.
Optionaly: numberThe vertical position of the Game Object in the world.
Optionalkey: stringThe texture key assigned to a new Game Object (if one is created). Default defaultKey.
Optionalframe: string | numberA texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
Optionalvisible: booleanThe Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created). Default true.
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.
OptionalcreateIfNull: booleanCreate a new Game Object if no matching members are found, using the following arguments. Default false.
Optionalx: numberThe horizontal position of the Game Object in the world.
Optionaly: numberThe vertical position of the Game Object in the world.
Optionalkey: stringThe texture key assigned to a new Game Object (if one is created). Default defaultKey.
Optionalframe: string | numberA texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
Optionalvisible: booleanThe Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created). Default true.
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.
The nth matching Group member to search for.
Optionalstate: booleanThe Phaser.GameObjects.GameObject#active value to match. Default false.
OptionalcreateIfNull: booleanCreate a new Game Object if no matching members are found, using the following arguments. Default false.
Optionalx: numberThe horizontal position of the Game Object in the world.
Optionaly: numberThe vertical position of the Game Object in the world.
Optionalkey: stringThe texture key assigned to a new Game Object (if one is created). Default defaultKey.
Optionalframe: string | numberA texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
Optionalvisible: booleanThe Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created). Default true.
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.
Optionalstate: booleanThe Phaser.GameObjects.GameObject#active value to match. Default false.
OptionalcreateIfNull: booleanCreate a new Game Object if no matching members are found, using the following arguments. Default false.
Optionalx: numberThe horizontal position of the Game Object in the world.
Optionaly: numberThe vertical position of the Game Object in the world.
Optionalkey: stringThe texture key assigned to a new Game Object (if one is created). Default defaultKey.
Optionalframe: string | numberA texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
Optionalvisible: booleanThe Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created). Default true.
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.
The nth matching Group member to search for.
Optionalstate: booleanThe Phaser.GameObjects.GameObject#active value to match. Default false.
OptionalcreateIfNull: booleanCreate a new Game Object if no matching members are found, using the following arguments. Default false.
Optionalx: numberThe horizontal position of the Game Object in the world.
Optionaly: numberThe vertical position of the Game Object in the world.
Optionalkey: stringThe texture key assigned to a new Game Object (if one is created). Default defaultKey.
Optionalframe: string | numberA texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
Optionalvisible: booleanThe Phaser.GameObjects.Components.Visible#visible state of a new Game Object (if one is created). Default true.
The number of members of the group.
Returns all children in this Group that match the given criteria based on the property and value arguments.
For example: getMatching('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.
Optionalproperty: stringThe property to test on each array element.
Optionalvalue: anyThe value to test the property against. Must pass a strict (===) comparison check.
OptionalstartIndex: numberAn optional start index to search from.
OptionalendIndex: numberAn optional end index to search to.
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.
Counts the number of in-use (active) group members.
Adds the given value to the x of each group member.
The amount to be added to the x property.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Adds the given value to the x, y of each group member.
The amount to be added to the x property.
Optionaly: numberThe amount to be added to the y property. If undefined or null it uses the x value. Default x.
OptionalstepX: numberThis is added to the x amount, multiplied by the iteration counter. Default 0.
OptionalstepY: numberThis is added to the y amount, multiplied by the iteration counter. Default 0.
Adds the given value to the y of each group member.
The amount to be added to the y property.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Whether this group's size at its maximum.
Deactivates a member of this group.
A member of this group.
Deactivates and hides a member of this group.
A member of this group.
Return the number of listeners listening to a given event.
The event name.
Return the listeners registered for a given event.
The event name.
Remove the listeners of a given event.
The event name.
Optionalfn: FunctionOnly remove the listeners that match this function.
Optionalcontext: anyOnly remove the listeners that have this context.
Optionalonce: booleanOnly remove one-time listeners.
Add a listener for a given event.
The event name.
The listener function.
Optionalcontext: anyThe context to invoke the listener with. Default this.
Add a one-time listener for a given event.
The event name.
The listener function.
Optionalcontext: anyThe context to invoke the listener with. Default this.
Plays an animation for all members of this group.
The string-based key of the animation to play.
OptionalstartFrame: stringOptionally start the animation playing from this frame index. Default 0.
Updates any group members, if Phaser.GameObjects.Group#runChildUpdate is enabled.
The current timestamp.
The delta time elapsed since the last frame.
Adds the given value to the property as defined in key of each group member.
The property to be updated.
The amount to set the property to.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Optionalindex: numberAn optional offset to start searching from within the items array. Default 0.
Optionaldirection: numberThe direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. Default 1.
Sets the property as defined in key of each group member to the given value.
The property to be updated.
The amount to set the property to.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Optionalindex: numberAn optional offset to start searching from within the items array. Default 0.
Optionaldirection: numberThe direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. Default 1.
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).
Removes a member of this Group and optionally removes it from the Scene and / or destroys it.
The Game Object to remove.
OptionalremoveFromScene: booleanOptionally remove the Group member from the Scene it belongs to. Default false.
OptionaldestroyChild: booleanOptionally call destroy on the removed Group member. Default false.
Remove all listeners, or those of the specified event.
Optionalevent: string | symbolThe event name.
Disables the group member's physics body, removing it from the simulation.
The group member being removed.
Removes the given Collision Category from the list of those that this Arcade Physics Body will collide with.
The collision category to add.
Remove the listeners of a given event.
The event name.
Optionalfn: FunctionOnly remove the listeners that match this function.
Optionalcontext: anyOnly remove the listeners that have this context.
Optionalonce: booleanOnly remove one-time listeners.
Resets the Collision Category and Mask back to the defaults, which is to collide with everything.
Sets the rotation of each group member.
The amount to set the rotation to, in radians.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Rotates each group member around the given point by the given angle.
Any object with public x and y properties.
The angle to rotate by, in radians.
Rotates each group member around the given point by the given angle and distance.
Any object with public x and y properties.
The angle to rotate by, in radians.
The distance from the point of rotation in pixels.
Sets the scaleX of each group member.
The amount to set the property to.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Sets the scaleX, scaleY of each group member.
The amount to be added to the scaleX property.
OptionalscaleY: numberThe amount to be added to the scaleY property. If undefined or null it uses the scaleX value.
OptionalstepX: numberThis is added to the scaleX amount, multiplied by the iteration counter. Default 0.
OptionalstepY: numberThis is added to the scaleY amount, multiplied by the iteration counter. Default 0.
Sets the scaleY of each group member.
The amount to set the property to.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Sets the active property of this Group.
When active, this Group runs its preUpdate method.
True if this Group should be set as active, false if not.
Sets the alpha of each group member.
The amount to set the alpha to.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Sets the blendMode of each group member.
The amount to set the property to.
Sets all of the Collision Categories that this Arcade Physics Body will collide with. You can either pass a single category value, or an array of them.
Calling this method will reset all of the collision categories, so only those passed to this method are enabled.
If you wish to add a new category to the existing mask, call
the addCollisionCategory method.
If you wish to reset the collision category and mask, call
the resetCollisionCategory method.
The collision category to collide with, or an array of them.
Sets the Collision Category that this Arcade Physics Body will use in order to determine what it can collide with.
It can only have one single category assigned to it.
If you wish to reset the collision category and mask, call
the resetCollisionCategory method.
The collision category.
Sets the depth of each group member.
The amount to set the property to.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Passes all group members to the Input Manager to enable them for input with identical areas and callbacks.
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.
A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback.
Sets the name property of this Group.
The name property is not populated by Phaser and is presented for your own use.
The name to be given to this Group.
Sets the originX, originY of each group member.
The amount to set the originX property to.
OptionaloriginY: numberThe amount to set the originY property to. If undefined or null it uses the originX value.
OptionalstepX: numberThis is added to the originX amount, multiplied by the iteration counter. Default 0.
OptionalstepY: numberThis is added to the originY amount, multiplied by the iteration counter. Default 0.
Sets the tint of each group member.
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.
OptionaltopRight: numberThe tint to be applied to top-right corner of item.
OptionalbottomLeft: numberThe tint to be applied to the bottom-left corner of item.
OptionalbottomRight: numberThe tint to be applied to the bottom-right corner of item.
Sets the visible of each group member.
The value to set the property to.
Optionalindex: numberAn optional offset to start searching from within the items array. Default 0.
Optionaldirection: numberThe direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. Default 1.
Sets the x of each group member.
The amount to set the property to.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
Sets the x, y of each group member.
The amount to set the x property to.
Optionaly: numberThe amount to set the y property to. If undefined or null it uses the x value. Default x.
OptionalstepX: numberThis is added to the x amount, multiplied by the iteration counter. Default 0.
OptionalstepY: numberThis is added to the y amount, multiplied by the iteration counter. Default 0.
Sets the y of each group member.
The amount to set the property to.
Optionalstep: numberThis is added to the value amount, multiplied by the iteration counter. Default 0.
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.
The x coordinate to place the first item in the array at.
The y coordinate to place the first item in the array at.
Optionaldirection: numberThe iteration direction. 0 = first to last and 1 = last to first. Default 0.
Shuffles the group members in place.
Removes all listeners.
Toggles (flips) the visible state of each member of this group.
Checks to see if the given Collision Category will collide with this Arcade Physics object or not.
Collision category value to test.
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.