Phaser. Utils

new Utils()

Source - utils/Utils.js, line 3

Classes

Debug

Methods

<static> extend(deep, target) → {object}

This is a slightly modified version of http://api.jquery.com/jQuery.extend/

Parameters:
Name Type Description
deep boolean

Perform a deep copy?

target object

The target object to copy to.

Returns:
object -

The extended object.

Source - utils/Utils.js, line 263

<static> getProperty(obj, prop) → {*}

Gets an objects property by string.

Parameters:
Name Type Description
obj object

The object to traverse.

prop string

The property whose value will be returned.

Returns:
* -

the value of the property or null if property isn't found .

Source - utils/Utils.js, line 13

<static> isPlainObject(obj) → {boolean}

This is a slightly modified version of jQuery.isPlainObject. A plain object is an object whose internal class property is [object Object].

Parameters:
Name Type Description
obj object

The object to inspect.

Returns:
boolean -
  • true if the object is plain, otherwise false.
Source - utils/Utils.js, line 227

<static> mixin(from, to) → {object}

Mixes the source object into the destination object, returning the newly modified destination object. Based on original code by @mudcube

Parameters:
Name Type Description
from object

The object to copy (the source object).

to object

The object to copy to (the destination object).

Returns:
object -

The modified destination object.

Source - utils/Utils.js, line 342

<static> pad(str, len, pad, dir) → {string}

Javascript string pad http://www.webtoolkit.info/.

Parameters:
Name Type Argument Default Description
str string

The target string.

len number

The number of characters to be added.

pad number

The string to pad it out with (defaults to a space).

dir number <optional>
3

The direction dir = 1 (left), 2 (right), 3 (both).

Returns:
string -

The padded string

Source - utils/Utils.js, line 185

<static> parseDimension(size, dimension) → {number}

Get a unit dimension from a string.

Parameters:
Name Type Description
size string | number

The size to parse.

dimension number

The window dimension to check.

Returns:
number -

The parsed dimension.

Source - utils/Utils.js, line 142

<static> rotateArray(matrix, direction) → {array}

This method is deprecated and should not be used. It may be removed in the future.

Rotates the given array. Based on the routine from http://jsfiddle.net/MrPolywhirl/NH42z/

Parameters:
Name Type Description
matrix array

The array to rotate.

direction number | string

The amount to rotate. Either a number: 90, -90, 270, -270, 180 or a string: 'rotateLeft', 'rotateRight' or 'rotate180'

Returns:
array -

The rotated array

Deprecated:
  • 2.2.0 - Use Phaser.ArrayUtils.rotateMatrix
Source - utils/Utils.js, line 116

<static> setProperty(obj, prop) → {object}

Sets an objects property by string.

Parameters:
Name Type Description
obj object

The object to traverse

prop string

The property whose value will be changed

Returns:
object -

The object on which the property was set.

Source - utils/Utils.js, line 46

<static> shuffle(array) → {array}

This method is deprecated and should not be used. It may be removed in the future.

A standard Fisher-Yates Array shuffle implementation.

Parameters:
Name Type Description
array array

The array to shuffle.

Returns:
array -

The shuffled array.

Deprecated:
  • 2.2.0 - User Phaser.ArrayUtils.shuffle
Source - utils/Utils.js, line 130

<static> transposeArray(array) → {array}

This method is deprecated and should not be used. It may be removed in the future.

Transposes the elements of the given Array.

Parameters:
Name Type Description
array array

The array to transpose.

Returns:
array -

The transposed array.

Deprecated:
  • 2.2.0 - Use Phaser.ArrayUtils.transposeMatrix
Source - utils/Utils.js, line 104

randomChoice(choice1, choice2) → {any}

Choose between one of two values randomly.

Parameters:
Name Type Description
choice1 any
choice2 any
Returns:
any -

The randomly selected choice

Source - utils/Utils.js, line 92
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Tue Nov 25 2014 00:18:03 GMT-0000 (GMT) using the DocStrap template.