You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
World.wrap will take a game object and if its x/y coordinates fall outside of the world bounds it will be repositioned on the opposite side, for a wrap-around effect.
Copy file name to clipboardExpand all lines: README.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,11 +76,12 @@ Version 2.0.4 - "Mos Shirare" - in development
76
76
* Key.reset has a new `hard` parameter which controls the severity of the reset. A soft reset doesn't remove any callbacks or event listeners.
77
77
* InputManager.resetLocked - If the Input Manager has been reset locked then all calls made to InputManager.reset, such as from a State change, are ignored.
78
78
* Group.resetCursor will reset the Group cursor back to the start of the group, or to the given index value.
79
+
* World.wrap will take a game object and if its x/y coordinates fall outside of the world bounds it will be repositioned on the opposite side, for a wrap-around effect.
79
80
80
81
81
82
### Bug Fixes
82
83
83
-
* The main Timer loop could incorrectly remove TimeEvent if a new one was added specifically during an event callback (thanks @garyyeap, fix #710)
84
+
* The main Timer loop could incorrectly remove a TimerEvent if a new one was added specifically during an event callback (thanks @garyyeap, fix #710)
84
85
* Fixed the use of the destroy parameter in Group.removeAll and related functions (thanks @AnderbergE, fix #717)
85
86
* P2.World.convertTilemap now correctly checks the collides parameter of the tiles as it converts them.
86
87
* Animation.destroy didn't correctly clear the onStart, onLoop and onComplete signals.
Copy file name to clipboardExpand all lines: src/core/World.js
+59Lines changed: 59 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,65 @@ Phaser.World.prototype.shutdown = function () {
104
104
105
105
};
106
106
107
+
/**
108
+
* This will take the given game object and check if its x/y coordinates fall outside of the world bounds.
109
+
* If they do it will reposition the object to the opposite side of the world, creating a wrap-around effect.
110
+
*
111
+
* @method Phaser.World#wrap
112
+
* @param {Phaser.Sprite|Phaser.Image|Phaser.TileSprite|Phaser.Text} sprite - The object you wish to wrap around the world bounds.
113
+
* @param {number} [padding=0] - Extra padding added equally to the sprite.x and y coordinates before checking if within the world bounds. Ignored if useBounds is true.
114
+
* @param {boolean} [useBounds=false] - If useBounds is false wrap checks the object.x/y coordinates. If true it does a more accurate bounds check, which is more expensive.
0 commit comments