@@ -29,6 +29,7 @@ module Phaser.Physics {
2929 this . scale = new Vec2 ( 1 , 1 ) ;
3030 }
3131
32+ this . diameter = diameter ;
3233 this . radius = diameter / 2 ;
3334 this . bounds = new Rectangle ( x + Math . round ( diameter / 2 ) , y + Math . round ( diameter / 2 ) , diameter , diameter ) ;
3435 this . position = new Vec2 ( x + this . bounds . halfWidth , y + this . bounds . halfHeight ) ;
@@ -49,6 +50,7 @@ module Phaser.Physics {
4950 public bounds : Rectangle ;
5051
5152 public radius : number ;
53+ public diameter : number ;
5254
5355 public preUpdate ( ) {
5456
@@ -89,19 +91,11 @@ module Phaser.Physics {
8991
9092 public render ( context :CanvasRenderingContext2D ) {
9193
92- context . beginPath ( ) ;
93- //context.strokeStyle = 'rgb(255,255,0)';
94- //context.strokeRect(this.position.x - this.bounds.halfWidth, this.position.y - this.bounds.halfHeight, this.bounds.width, this.bounds.height);
95- //context.fillStyle = 'rgba(0,0,255,0.8)';
96- context . strokeStyle = 'rgba(0,0,255,0.5)' ;
97- context . arc ( this . position . x , this . position . y , this . radius , 0 , Math . PI * 2 ) ;
98- //context.fill();
99- context . stroke ( ) ;
100- context . closePath ( ) ;
101-
10294 // center point
103- context . fillStyle = 'rgb(255,255,0)' ;
104- context . fillRect ( this . position . x , this . position . y , 2 , 2 ) ;
95+ context . fillStyle = 'rgba(255,0,0,0.5)' ;
96+ context . arc ( this . position . x , this . position . y , this . radius , 0 , Math . PI * 2 ) ;
97+ context . rect ( this . position . x , this . position . y , 2 , 2 ) ;
98+ context . fill ( ) ;
10599
106100 /*
107101 if (this.oH == 1)
@@ -149,11 +143,13 @@ module Phaser.Physics {
149143
150144 if ( this . deltaX > 0 )
151145 {
152- return this . bounds . width + this . deltaX ;
146+ //return this.bounds.width + this.deltaX;
147+ return this . diameter + this . deltaX ;
153148 }
154149 else
155150 {
156- return this . bounds . width - this . deltaX ;
151+ //return this.bounds.width - this.deltaX;
152+ return this . diameter - this . deltaX ;
157153 }
158154
159155 }
@@ -162,11 +158,13 @@ module Phaser.Physics {
162158
163159 if ( this . deltaY > 0 )
164160 {
165- return this . bounds . height + this . deltaY ;
161+ //return this.bounds.height + this.deltaY;
162+ return this . diameter + this . deltaY ;
166163 }
167164 else
168165 {
169- return this . bounds . height - this . deltaY ;
166+ //return this.bounds.height - this.deltaY;
167+ return this . diameter - this . deltaY ;
170168 }
171169
172170 }
@@ -213,7 +211,6 @@ module Phaser.Physics {
213211 return this . position . y - this . oldPosition . y ;
214212 }
215213
216-
217214 }
218215
219216}
0 commit comments