Skip to content

Commit 9941942

Browse files
committed
Merge pull request phaserjs#1030 from codevinsky/rope
Phaser.Rope
2 parents 7fe4abc + f969c15 commit 9941942

6 files changed

Lines changed: 879 additions & 1 deletion

File tree

src/Phaser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var Phaser = Phaser || {
4444
SPRITEBATCH: 17,
4545
RETROFONT: 18,
4646
POINTER: 19,
47+
ROPE: 20,
4748

4849
// The various blend modes supported by pixi / phaser
4950
blendModes: {
@@ -81,4 +82,4 @@ var Phaser = Phaser || {
8182
PIXI.InteractionManager = PIXI.InteractionManager || function () {};
8283

8384
// Equally we're going to supress the Pixi console log, with their agreement.
84-
PIXI.dontSayHello = true;
85+
PIXI.dontSayHello = true;

src/gameobjects/GameObjectCreator.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,24 @@ Phaser.GameObjectCreator.prototype = {
158158

159159
},
160160

161+
/**
162+
* Creates a new Rope object.
163+
*
164+
* @method Phaser.GameObjectCreator#rope
165+
* @param {number} x - The x coordinate (in world space) to position the Rope at.
166+
* @param {number} y - The y coordinate (in world space) to position the Rope at.
167+
* @param {number} width - The width of the Rope.
168+
* @param {number} height - The height of the Rope.
169+
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
170+
* @param {string|number} frame - If this Rope is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
171+
* @return {Phaser.Rope} The newly created rope object.
172+
*/
173+
rope: function (x, y, key, frame, points) {
174+
175+
return new Phaser.Rope(this.game, x, y, key, frame, points);
176+
177+
},
178+
161179
/**
162180
* Creates a new Text object.
163181
*

src/gameobjects/GameObjectFactory.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,27 @@ Phaser.GameObjectFactory.prototype = {
200200

201201
},
202202

203+
/**
204+
* Creates a new Rope object.
205+
*
206+
* @method Phaser.GameObjectFactory#rope
207+
* @param {number} x - The x coordinate (in world space) to position the TileSprite at.
208+
* @param {number} y - The y coordinate (in world space) to position the TileSprite at.
209+
* @param {number} width - The width of the TileSprite.
210+
* @param {number} height - The height of the TileSprite.
211+
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
212+
* @param {string|number} frame - If this TileSprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
213+
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
214+
* @return {Phaser.TileSprite} The newly created tileSprite object.
215+
*/
216+
rope: function (x, y, key, frame, points, group) {
217+
218+
if (typeof group === 'undefined') { group = this.world; }
219+
220+
return group.add(new Phaser.Rope(this.game, x, y, key, frame, points));
221+
222+
},
223+
203224
/**
204225
* Creates a new Text object.
205226
*

0 commit comments

Comments
 (0)