Skip to content

Commit 84373dc

Browse files
committed
Removed use of the tilePosition property in the Phaser.Rope class as it isn't implemented and caused calls to Rope.reset to crash (thanks @spayton phaserjs#2135)
1 parent 8e4dc1f commit 84373dc

2 files changed

Lines changed: 8 additions & 26 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ can be controlled per-input mode.
323323
* Keyboard.addCallbacks didn't check to see if the arguments were `null`, only if they were `undefined` making the jsdocs misleading.
324324
* ScaleManager.getParentBounds now takes any transforms into account to get the correct parent bounds (thanks @jdnichollsc #2111 #2098)
325325
* Cache.addBitmapFont now applies a default value for the x and y spacing if the arguments are omitted (thanks @nlotz #2128)
326+
* Removed use of the `tilePosition` property in the Phaser.Rope class as it isn't implemented and caused calls to `Rope.reset` to crash (thanks @spayton #2135)
326327

327328
### Pixi Updates
328329

src/gameobjects/Rope.js

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*/
66

77
/**
8-
* A Rope is a Sprite that has a repeating texture. The texture can be scrolled and scaled and will automatically wrap on the edges as it does so.
9-
* Please note that Ropes, as with normal Sprites, have no input handler or physics bodies by default. Both need enabling.
10-
* Example usage: https://github.com/codevinsky/phaser-rope-demo/blob/master/dist/demo.js
8+
* A Rope is a Sprite that has a repeating texture.
9+
*
10+
* The texture will automatically wrap on the edges as it moves.
11+
*
12+
* Please note that Ropes cannot have an input handler.
1113
*
1214
* @class Phaser.Rope
1315
* @constructor
@@ -22,7 +24,6 @@
2224
* @extends Phaser.Component.Delta
2325
* @extends Phaser.Component.Destroy
2426
* @extends Phaser.Component.FixedToCamera
25-
* @extends Phaser.Component.InputEnabled
2627
* @extends Phaser.Component.InWorld
2728
* @extends Phaser.Component.LifeSpan
2829
* @extends Phaser.Component.LoadTexture
@@ -55,12 +56,6 @@ Phaser.Rope = function (game, x, y, key, frame, points) {
5556
*/
5657
this.type = Phaser.ROPE;
5758

58-
/**
59-
* @property {Phaser.Point} _scroll - Internal cache var.
60-
* @private
61-
*/
62-
this._scroll = new Phaser.Point();
63-
6459
PIXI.Rope.call(this, PIXI.TextureCache['__default'], this.points);
6560

6661
Phaser.Component.Core.init.call(this, game, x, y, key, frame);
@@ -80,7 +75,6 @@ Phaser.Component.Core.install.call(Phaser.Rope.prototype, [
8075
'Delta',
8176
'Destroy',
8277
'FixedToCamera',
83-
'InputEnabled',
8478
'InWorld',
8579
'LifeSpan',
8680
'LoadTexture',
@@ -104,16 +98,6 @@ Phaser.Rope.prototype.preUpdateCore = Phaser.Component.Core.preUpdate;
10498
*/
10599
Phaser.Rope.prototype.preUpdate = function() {
106100

107-
if (this._scroll.x !== 0)
108-
{
109-
this.tilePosition.x += this._scroll.x * this.game.time.physicsElapsed;
110-
}
111-
112-
if (this._scroll.y !== 0)
113-
{
114-
this.tilePosition.y += this._scroll.y * this.game.time.physicsElapsed;
115-
}
116-
117101
if (!this.preUpdatePhysics() || !this.preUpdateLifeSpan() || !this.preUpdateInWorld())
118102
{
119103
return false;
@@ -139,7 +123,7 @@ Phaser.Rope.prototype.update = function() {
139123
};
140124

141125
/**
142-
* Resets the Rope. This places the Rope at the given x/y world coordinates, resets the tilePosition and then
126+
* Resets the Rope. This places the Rope at the given x/y world coordinates and then
143127
* sets alive, exists, visible and renderable all to true. Also resets the outOfBounds state.
144128
* If the Rope has a physics body that too is reset.
145129
*
@@ -153,15 +137,12 @@ Phaser.Rope.prototype.reset = function(x, y) {
153137

154138
Phaser.Component.Reset.prototype.reset.call(this, x, y);
155139

156-
this.tilePosition.x = 0;
157-
this.tilePosition.y = 0;
158-
159140
return this;
160141

161142
};
162143

163144
/**
164-
* A Rope will call it's updateAnimation function on each update loop if it has one
145+
* A Rope will call its updateAnimation function on each update loop if it has one.
165146
*
166147
* @name Phaser.Rope#updateAnimation
167148
* @property {function} updateAnimation - Set to a function if you'd like the rope to animate during the update phase. Set to false or null to remove it.

0 commit comments

Comments
 (0)