Phaser API Documentation

wrap(object, [padding])


Wrap an object's coordinates (or several objects' coordinates) within Phaser.Physics.Arcade.World#bounds.

If the object is outside any boundary edge (left, top, right, bottom), it will be moved to the same offset from the opposite edge (the interior).


name type arguments description
object any

A Game Object, a Group, an object with x and y coordinates, or an array of such objects.

padding number <optional>

An amount added to each boundary edge during the operation.

Since: 3.3.0