Skip to content

Commit 64b1794

Browse files
committed
Rope.segments used the wrong vertices property, causing a runtime error.
Debug.ropeSegments didn't take the scale of the Rope object into consideration, causing incorrect debug rendering.
1 parent 47e1d16 commit 64b1794

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ Version 2.4 - "Katar" - in dev
425425
* Text.addColor would incorrectly color the text stroke if set (thanks @llevkin #1893)
426426
* Setting the scaleMode property of a Game configuration object would cause a ScaleManager TypeError in the resize method. It now stores the scale mode locally and applies it after boot (thanks @Mickawesomesque #1534)
427427
* Device.windowsPhone should now correctly identify Windows Phone 8.1 devices, which also think they are iOS and Androids. If you find a device that gets around this check please send us its ua string! (thanks @jounii #1496)
428+
* Rope.segments used the wrong vertices property, causing a runtime error.
429+
* Debug.ropeSegments didn't take the scale of the Rope object into consideration, causing incorrect debug rendering.
428430

429431
### Deprecated
430432

src/gameobjects/Rope.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,20 +208,21 @@ Object.defineProperty(Phaser.Rope.prototype, "segments", {
208208
{
209209
index = i * 4;
210210

211-
x1 = this.verticies[index];
212-
y1 = this.verticies[index + 1];
213-
x2 = this.verticies[index + 4];
214-
y2 = this.verticies[index + 3];
211+
x1 = this.vertices[index] * this.scale.x;
212+
y1 = this.vertices[index + 1] * this.scale.y;
213+
x2 = this.vertices[index + 4] * this.scale.x;
214+
y2 = this.vertices[index + 3] * this.scale.y;
215215

216-
width = Phaser.Math.difference(x1,x2);
217-
height = Phaser.Math.difference(y1,y2);
216+
width = Phaser.Math.difference(x1, x2);
217+
height = Phaser.Math.difference(y1, y2);
218218

219219
x1 += this.world.x;
220220
y1 += this.world.y;
221-
rect = new Phaser.Rectangle(x1,y1, width, height);
221+
rect = new Phaser.Rectangle(x1, y1, width, height);
222222
segments.push(rect);
223223
}
224224

225225
return segments;
226226
}
227+
227228
});

src/utils/Debug.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,14 @@ Phaser.Utils.Debug.prototype = {
443443
},
444444

445445
/**
446-
* Renders the Rope's segments. Note: This is really expensive as it has to calculate new segments everytime you call it
446+
* Renders the Rope's segments. Note: This is really expensive as it has to calculate new segments every time you call it
447447
*
448448
* @method Phaser.Utils.Debug#ropeSegments
449449
* @param {Phaser.Rope} rope - The rope to display the segments of.
450450
* @param {string} [color] - Color of the debug info to be rendered (format is css color string).
451451
* @param {boolean} [filled=true] - Render the rectangle as a fillRect (default, true) or a strokeRect (false)
452452
*/
453-
ropeSegments: function(rope, color, filled) {
453+
ropeSegments: function (rope, color, filled) {
454454

455455
var segments = rope.segments;
456456

0 commit comments

Comments
 (0)