Group#setAllChildren()

setAllChildren(key, value, checkAlive, checkVisible, operation, force)

Quickly set the same property across all children of this group, and any child Groups, to a new value.

If this group contains other Groups then the same property is set across their children as well, iterating down until it reaches the bottom.
Unlike with setAll the property is NOT set on child Groups itself.

The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.

Parameters
Name Type Argument Default Description
key string

The property, as a string, to be set. For example: 'body.velocity.x'

value any

The value that will be set.

checkAlive boolean <optional>
false

If set then only children with alive=true will be updated. This includes any Groups that are children.

checkVisible boolean <optional>
false

If set then only children with visible=true will be updated. This includes any Groups that are children.

operation integer <optional>
0

Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.

force boolean <optional>
false

If force is true then the property will be set on the child regardless if it already exists or not. If false and the property doesn't exist, nothing will be set.

Source code: core/Group.js (Line 1312)
doc_phaser
2017-02-14 10:51:48
Comments
Leave a Comment

Please login to continue.