Group#set()

set(child, key, value, checkAlive, checkVisible, operation, force) → {boolean}

Quickly set a property on a single child of this group to a new value.

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
child Phaser.Sprite

The child to set the property on.

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 the child will only be updated if alive=true.

checkVisible boolean <optional>
false

If set then the child will only be updated if visible=true.

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.

Returns
boolean -

True if the property was set, false if not.

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

Please login to continue.