Takes an array of Game Objects, or any objects that have public x
and y
properties, and aligns them next to each other.
The first item isn't moved. The second item is aligned next to the first, then the third next to the second, and so on.
name | type | arguments | description |
---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
|
position | number |
The position to align the items with. This is an align constant, such as |
|
offsetX | number | <optional> |
Optional horizontal offset from the position. |
offsetY | number | <optional> |
Optional vertical offset from the position. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have a public angle
property,
and then adds the given value to each of their angle
properties.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: Angle(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to be added to the |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of objects and passes each of them to the given callback.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
callback | Phaser.Types.Actions.CallCallback |
The callback to be invoked. It will be passed just one argument: the item from the array. |
context | * |
The scope in which the callback will be invoked. |
The array of objects that was passed to this Action.
Takes an array of objects and returns the first element in the array that has properties which match
all of those specified in the compare
object. For example, if the compare object was: { scaleX: 0.5, alpha: 1 }
then it would return the first item which had the property scaleX
set to 0.5 and alpha
set to 1.
To use this with a Group: GetFirst(group.getChildren(), compare, index)
name | type | arguments | description |
---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be searched by this action. |
|
compare | object |
The comparison object. Each property in this object will be checked against the items of the array. |
|
index | number | <optional> |
An optional offset to start searching from within the items array. |
The first object in the array that matches the comparison object, or null
if no match was found.
Takes an array of objects and returns the last element in the array that has properties which match
all of those specified in the compare
object. For example, if the compare object was: { scaleX: 0.5, alpha: 1 }
then it would return the last item which had the property scaleX
set to 0.5 and alpha
set to 1.
To use this with a Group: GetLast(group.getChildren(), compare, index)
name | type | arguments | description |
---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be searched by this action. |
|
compare | object |
The comparison object. Each property in this object will be checked against the items of the array. |
|
index | number | <optional> |
An optional offset to start searching from within the items array. |
The last object in the array that matches the comparison object, or null
if no match was found.
Takes an array of Game Objects, or any objects that have public x
and y
properties,
and then aligns them based on the grid configuration given to this action.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
options | Phaser.Types.Actions.GridAlignConfig |
The GridAlign Configuration object. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have a public alpha
property,
and then adds the given value to each of their alpha
properties.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: IncAlpha(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to be added to the |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have a public x
property,
and then adds the given value to each of their x
properties.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: IncX(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to be added to the |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have public x
and y
properties,
and then adds the given value to each of them.
The optional stepX
and stepY
properties are applied incrementally, multiplied by each item in the array.
To use this with a Group: IncXY(group.getChildren(), x, y, stepX, stepY)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
x | number |
The amount to be added to the |
||
y | number | <optional> | x |
The amount to be added to the |
stepX | number | <optional> | 0 |
This is added to the |
stepY | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have a public y
property,
and then adds the given value to each of their y
properties.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: IncY(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to be added to the |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Circle.
If you wish to pass a Phaser.GameObjects.Circle
Shape to this function, you should pass its geom
property.
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
||
circle | Phaser.Geom.Circle |
The Circle to position the Game Objects on. |
||
startAngle | number | <optional> | 0 |
Optional angle to start position from, in radians. |
endAngle | number | <optional> | 6.28 |
Optional angle to stop position at, in radians. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of an Ellipse.
If you wish to pass a Phaser.GameObjects.Ellipse
Shape to this function, you should pass its geom
property.
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
||
ellipse | Phaser.Geom.Ellipse |
The Ellipse to position the Game Objects on. |
||
startAngle | number | <optional> | 0 |
Optional angle to start position from, in radians. |
endAngle | number | <optional> | 6.28 |
Optional angle to stop position at, in radians. |
The array of Game Objects that was passed to this Action.
Positions an array of Game Objects on evenly spaced points of a Line.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
line | Phaser.Geom.Line |
The Line to position the Game Objects on. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Rectangle.
Placement starts from the top-left of the rectangle, and proceeds in a clockwise direction.
If the shift
parameter is given you can offset where placement begins.
name | type | arguments | description |
---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
|
rect | Phaser.Geom.Rectangle |
The Rectangle to position the Game Objects on. |
|
shift | number | <optional> |
An optional positional offset. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects and positions them on evenly spaced points around the edges of a Triangle.
If you wish to pass a Phaser.GameObjects.Triangle
Shape to this function, you should pass its geom
property.
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
||
triangle | Phaser.Geom.Triangle |
The Triangle to position the Game Objects on. |
||
stepRate | number | <optional> | 1 |
An optional step rate, to increase or decrease the packing of the Game Objects on the lines. |
The array of Game Objects that was passed to this Action.
Play an animation on all Game Objects in the array that have an Animation component.
You can pass either an animation key, or an animation configuration object for more control over the playback.
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
||
key | string | Phaser.Animations.Animation | Phaser.Types.Animations.PlayAnimationConfig |
The string-based key of the animation to play, or an Animation instance, or a |
||
ignoreIfPlaying | boolean | <optional> | false |
If this animation is already playing then ignore this call. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects, or any objects that have a public property as defined in key
,
and then adds the given value to it.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: PropertyValueInc(group.getChildren(), key, value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
key | string |
The property to be updated. |
||
value | number |
The amount to be added to the property. |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have a public property as defined in key
,
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: PropertyValueSet(group.getChildren(), key, value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
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 |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects and positions them at random locations within the Circle.
If you wish to pass a Phaser.GameObjects.Circle
Shape to this function, you should pass its geom
property.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
circle | Phaser.Geom.Circle |
The Circle to position the Game Objects within. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects and positions them at random locations within the Ellipse.
If you wish to pass a Phaser.GameObjects.Ellipse
Shape to this function, you should pass its geom
property.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
ellipse | Phaser.Geom.Ellipse |
The Ellipse to position the Game Objects within. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects and positions them at random locations on the Line.
If you wish to pass a Phaser.GameObjects.Line
Shape to this function, you should pass its geom
property.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
line | Phaser.Geom.Line |
The Line to position the Game Objects randomly on. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects and positions them at random locations within the Rectangle.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
rect | Phaser.Geom.Rectangle |
The Rectangle to position the Game Objects within. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects and positions them at random locations within the Triangle.
If you wish to pass a Phaser.GameObjects.Triangle
Shape to this function, you should pass its geom
property.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
triangle | Phaser.Geom.Triangle |
The Triangle to position the Game Objects within. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects, or any objects that have a public rotation
property,
and then adds the given value to each of their rotation
properties.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: Rotate(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to be added to the |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Rotates each item around the given point by the given angle.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
point | object |
Any object with public |
angle | number |
The angle to rotate by, in radians. |
The array of Game Objects that was passed to this Action.
Rotates an array of Game Objects around a point by the given angle and distance.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
point | object |
Any object with public |
angle | number |
The angle to rotate by, in radians. |
distance | number |
The distance from the point of rotation in pixels. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects, or any objects that have a public scaleX
property,
and then adds the given value to each of their scaleX
properties.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: ScaleX(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to be added to the |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have public scaleX
and scaleY
properties,
and then adds the given value to each of them.
The optional stepX
and stepY
properties are applied incrementally, multiplied by each item in the array.
To use this with a Group: ScaleXY(group.getChildren(), scaleX, scaleY, stepX, stepY)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
scaleX | number |
The amount to be added to the |
||
scaleY | number | <optional> |
The amount to be added to the |
|
stepX | number | <optional> | 0 |
This is added to the |
stepY | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have a public scaleY
property,
and then adds the given value to each of their scaleY
properties.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: ScaleY(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to be added to the |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public property alpha
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: SetAlpha(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to set the property to. |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public property blendMode
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: SetBlendMode(group.getChildren(), value)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount 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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public property depth
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: SetDepth(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to set the property to. |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Passes all provided Game Objects to the Input Manager to enable them for input with identical areas and callbacks.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
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. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects, or any objects that have the public properties originX
and originY
and then sets them to the given values.
The optional stepX
and stepY
properties are applied incrementally, multiplied by each item in the array.
To use this with a Group: SetOrigin(group.getChildren(), originX, originY, stepX, stepY)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
originX | number |
The amount to set the |
||
originY | number | <optional> |
The amount to set the |
|
stepX | number | <optional> | 0 |
This is added to the |
stepY | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public property rotation
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: SetRotation(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to set the property to. |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public properties scaleX
and scaleY
and then sets them to the given values.
The optional stepX
and stepY
properties are applied incrementally, multiplied by each item in the array.
To use this with a Group: SetScale(group.getChildren(), scaleX, scaleY, stepX, stepY)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
scaleX | number |
The amount to set the |
||
scaleY | number | <optional> |
The amount to set the |
|
stepX | number | <optional> | 0 |
This is added to the |
stepY | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public property scaleX
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: SetScaleX(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to set the property to. |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public property scaleY
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: SetScaleY(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to set the property to. |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public properties scrollFactorX
and scrollFactorY
and then sets them to the given values.
The optional stepX
and stepY
properties are applied incrementally, multiplied by each item in the array.
To use this with a Group: SetScrollFactor(group.getChildren(), scrollFactorX, scrollFactorY, stepX, stepY)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
scrollFactorX | number |
The amount to set the |
||
scrollFactorY | number | <optional> |
The amount to set the |
|
stepX | number | <optional> | 0 |
This is added to the |
stepY | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public property scrollFactorX
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: SetScrollFactorX(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to set the property to. |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public property scrollFactorY
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: SetScrollFactorY(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to set the property to. |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public method setTint() and then updates it to the given value(s). You can specify tint color per corner or provide only one color value for topLeft
parameter, in which case whole item will be tinted with that color.
name | type | arguments | description |
---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
|
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. |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects, or any objects that have the public property visible
and then sets it to the given value.
To use this with a Group: SetVisible(group.getChildren(), value)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public property x
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: SetX(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to set the property to. |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public properties x
and y
and then sets them to the given values.
The optional stepX
and stepY
properties are applied incrementally, multiplied by each item in the array.
To use this with a Group: SetXY(group.getChildren(), x, y, stepX, stepY)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
x | number |
The amount to set the |
||
y | number | <optional> | x |
The amount to set the |
stepX | number | <optional> | 0 |
This is added to the |
stepY | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Takes an array of Game Objects, or any objects that have the public property y
and then sets it to the given value.
The optional step
property is applied incrementally, multiplied by each item in the array.
To use this with a Group: SetY(group.getChildren(), value, step)
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
The array of items to be updated by this action. |
||
value | number |
The amount to set the property to. |
||
step | number | <optional> | 0 |
This is added to the |
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. |
The array of objects that were passed to this Action.
Iterate through the items array 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 items position is set to x/y.
The final x/y coords are returned
name | type | arguments | description |
---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
|
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> |
The iteration direction. 0 = first to last and 1 = last to first. |
output | object | Phaser.Math.Vector2 | <optional> |
An optional objec to store the final objects position in. |
The output vector.
Shuffles the array in place. The shuffled array is both modified and returned.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
The array of Game Objects that was passed to this Action.
Smootherstep is a sigmoid-like interpolation and clamping function.
The function depends on three parameters, the input x, the "left edge" and the "right edge", with the left edge being assumed smaller than the right edge. The function receives a real number x as an argument and returns 0 if x is less than or equal to the left edge, 1 if x is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, between 0 and 1 otherwise. The slope of the smoothstep function is zero at both edges. This is convenient for creating a sequence of transitions using smoothstep to interpolate each segment as an alternative to using more sophisticated or expensive interpolation techniques.
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
||
property | string |
The property of the Game Object to interpolate. |
||
min | number |
The minimum interpolation value. |
||
max | number |
The maximum interpolation value. |
||
inc | boolean | <optional> | false |
Should the values be incremented? |
The array of Game Objects that was passed to this Action.
Smoothstep is a sigmoid-like interpolation and clamping function.
The function depends on three parameters, the input x, the "left edge" and the "right edge", with the left edge being assumed smaller than the right edge. The function receives a real number x as an argument and returns 0 if x is less than or equal to the left edge, 1 if x is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, between 0 and 1 otherwise. The slope of the smoothstep function is zero at both edges. This is convenient for creating a sequence of transitions using smoothstep to interpolate each segment as an alternative to using more sophisticated or expensive interpolation techniques.
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
||
property | string |
The property of the Game Object to interpolate. |
||
min | number |
The minimum interpolation value. |
||
max | number |
The maximum interpolation value. |
||
inc | boolean | <optional> | false |
Should the values be incremented? |
The array of Game Objects that was passed to this Action.
Takes an array of Game Objects and then modifies their property
so the value equals, or is incremented, by the
calculated spread value.
The spread value is derived from the given min
and max
values and the total number of items in the array.
For example, to cause an array of Sprites to change in alpha from 0 to 1 you could call:
Phaser.Actions.Spread(itemsArray, 'alpha', 0, 1);
name | type | arguments | Default | description |
---|---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
||
property | string |
The property of the Game Object to spread. |
||
min | number |
The minimum value. |
||
max | number |
The maximum value. |
||
inc | boolean | <optional> | false |
Should the values be incremented? |
The array of Game Objects that were passed to this Action.
Takes an array of Game Objects and toggles the visibility of each one.
Those previously visible = false
will become visible = true
, and vice versa.
name | type | description |
---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
The array of Game Objects that was passed to this Action.
Wrap each item's coordinates within a rectangle's area.
name | type | arguments | description |
---|---|---|---|
items | array | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects. The contents of this array are updated by this Action. |
|
rect | Phaser.Geom.Rectangle |
The rectangle. |
|
padding | number | <optional> |
An amount added to each side of the rectangle during the operation. |
The array of Game Objects that was passed to this Action.