diff --git a/examples/camera3.php b/examples/camera3.php index e2d2daf1..001f1216 100644 --- a/examples/camera3.php +++ b/examples/camera3.php @@ -30,20 +30,20 @@ s.addChild(s2); // s.angle = 45; - s.scale.x = 0.5; - s.scale.y = 0.5; - // s2.scale.x = 2; - // s2.scale.y = 2; + s.scale.x = 2; + s.scale.y = 2; + s2.scale.x = 0.5; + s2.scale.y = 0.5; s.anchor.setTo(0.5, 0.5); - s2.anchor.setTo(0.5, 0.5); + s2.anchor.setTo(0, 0); } function update() { s.angle += 0.5; - // s2.angle += 1; + s2.angle += 1; if (s.scale.x > -2) { @@ -55,11 +55,6 @@ function render() { - var scale1X = Math.sqrt((s2.worldTransform[0] * s2.worldTransform[0]) + (s2.worldTransform[1] * s2.worldTransform[1])); - var scale1Y = Math.sqrt((s2.worldTransform[3] * s2.worldTransform[3]) + (s2.worldTransform[4] * s2.worldTransform[4])); - - game.debug.renderText('scaleX: ' + scale1X + ' scaleY: ' + scale1Y, 500, 32); - game.debug.renderWorldTransformInfo(s, 32, 32); game.debug.renderLocalTransformInfo(s, 300, 32); diff --git a/src/gameobjects/Sprite.js b/src/gameobjects/Sprite.js index b6686481..02fb0d9c 100644 --- a/src/gameobjects/Sprite.js +++ b/src/gameobjects/Sprite.js @@ -158,8 +158,8 @@ Phaser.Sprite.prototype.update = function() { this._sx = Math.sqrt((this._a00 * this._a00) + (this._a01 * this._a01)); this._sy = Math.sqrt((this._a10 * this._a10) + (this._a11 * this._a11)); - this._sw = this.width * this._sx; - this._sh = this.height * this._sy; + this._sw = this.texture.frame.width * this._sx; + this._sh = this.texture.frame.height * this._sy; this._a01 *= -1; this._a10 *= -1; @@ -167,12 +167,12 @@ Phaser.Sprite.prototype.update = function() { this._id = 1 / (this._a00 * this._a11 + this._a01 * -this._a10); // Update the edge points - this.offset.setTo(this._a02 - (this.anchor.x * this.width), this._a12 - (this.anchor.y * this.height)); + this.offset.setTo(this._a02 - (this.anchor.x * this._sw), this._a12 - (this.anchor.y * this._sh)); this.getLocalPosition(this.topLeft, this.offset.x, this.offset.y); - this.getLocalPosition(this.topRight, this.offset.x + this.width, this.offset.y); - this.getLocalPosition(this.bottomLeft, this.offset.x, this.offset.y + this.height); - this.getLocalPosition(this.bottomRight, this.offset.x + this.width, this.offset.y + this.height); + this.getLocalPosition(this.topRight, this.offset.x + this._sw, this.offset.y); + this.getLocalPosition(this.bottomLeft, this.offset.x, this.offset.y + this._sh); + this.getLocalPosition(this.bottomRight, this.offset.x + this._sw, this.offset.y + this._sh); // this.checkBounds(); diff --git a/src/utils/Debug.js b/src/utils/Debug.js index df64528a..c1ec2c3a 100644 --- a/src/utils/Debug.js +++ b/src/utils/Debug.js @@ -332,13 +332,14 @@ Phaser.Utils.Debug.prototype = { this.start(x, y, color); this.line('Local Transform'); - // this.line('testX: ' + Math.floor(sprite.localTransform[3] + sprite.localTransform[0])); this.line('skewX: ' + sprite.localTransform[3]); this.line('skewY: ' + sprite.localTransform[1]); this.line('scaleX: ' + sprite.localTransform[0]); this.line('scaleY: ' + sprite.localTransform[4]); this.line('transX: ' + sprite.localTransform[2]); this.line('transY: ' + sprite.localTransform[5]); + this.line('sX: ' + sprite._sx); + this.line('sY: ' + sprite._sy); },