@@ -93,6 +93,13 @@ function create() {
9393 function update() {
9494
9595 s.angle += 0.5;
96+
97+ if (s.scale.x < 2)
98+ {
99+ s.scale.x += 0.01;
100+ s.scale.y += 0.01;
101+ }
102+
96103 }
97104
98105 function render() {
@@ -101,16 +108,18 @@ function render() {
101108
102109 // var p1 = getLocalPosition(midpoint.x, midpoint.y, s);
103110
104- var p1 = getLocalPosition(tl.x, tl.y, s);
105- var p2 = getLocalPosition(tr.x, tr.y, s);
106- var p3 = getLocalPosition(bl.x, bl.y, s);
107- var p4 = getLocalPosition(br.x, br.y, s);
111+ // top left
112+ var p1 = getLocalPosition(s.x, s.y, s);
113+
114+ // top right
115+ var p2 = getLocalPosition(s.x + s.width, s.y, s);
116+
117+ // bottom left
118+ var p3 = getLocalPosition(s.x, s.y + s.height, s);
119+
120+ // bottom right
121+ var p4 = getLocalPosition(s.x + s.width, s.y + s.height, s);
108122
109- // p1.add(100, 100);
110- // p2.add(100, 100);
111- // p3.add(100, 100);
112- // p4.add(100, 100);
113- // p1.add(s.x + (s.anchor.x * (s.width / 2)), s.y + (s.anchor.y * (s.height / 2)));
114123 p1.add(s.x, s.y);
115124 p2.add(s.x, s.y);
116125 p3.add(s.x, s.y);
@@ -134,7 +143,7 @@ function render() {
134143 }
135144
136145 function getLocalPosition (x, y, displayObject) {
137-
146+
138147 var a00 = displayObject.worldTransform[0]; // scaleX
139148 var a01 = displayObject.worldTransform[1]; // skewY
140149 var a02 = displayObject.worldTransform[2]; // translateX
@@ -150,7 +159,7 @@ function getLocalPosition (x, y, displayObject) {
150159 var dx = a11 * id * x + -a01 * id * y + (a12 * a01 - a02 * a11) * id;
151160 var dy = a00 * id * y + -a10 * id * x + (-a12 * a00 + a02 * a10) * id;
152161
153- return new Phaser.Point(dx, dy);
162+ return new Phaser.Point(dx * displayObject.scale.x , dy * displayObject.scale.y );
154163
155164 }
156165
0 commit comments