Math#wrapValue()

wrapValue(value, amount, max) → {number}

Adds value to amount and ensures that the result always stays between 0 and max, by wrapping the value around.

Values must be positive integers, and are passed through Math.abs. See Phaser.Math#wrap for an alternative.

Parameters
Name Type Description
value number

The value to add the amount to.

amount number

The amount to add to the value.

max number

The maximum the value is allowed to be.

Returns
number -

The wrapped value.

Source code: math/Math.js (Line 552)
doc_phaser
2017-02-14 10:55:07
Comments
Leave a Comment

Please login to continue.