This commit is contained in:
Richard Davey 2020-09-12 10:28:20 +01:00
commit 74cd3c5d93

View file

@ -279,6 +279,26 @@ var Transform = {
return this;
},
/**
* Copies an object's coordinates to this Game Object's position.
*
* @method Phaser.GameObjects.Components.Transform#copyPosition
* @since 3.50.0
*
* @param {(Phaser.Types.Math.Vector2Like|Phaser.Types.Math.Vector3Like|Phaser.Types.Math.Vector4Like)} source - An object with numeric 'x', 'y', 'z', or 'w' properties. Undefined values are not copied.
*
* @return {this} This Game Object instance.
*/
copyPosition: function (source)
{
if (source.x !== undefined) { this.x = source.x; }
if (source.y !== undefined) { this.y = source.y; }
if (source.z !== undefined) { this.z = source.z; }
if (source.w !== undefined) { this.w = source.w; }
return this;
},
/**
* Sets the position of this Game Object to be a random position within the confines of
* the given area.