@@ -60,7 +60,7 @@ module Phaser {
6060 private _fxShakeIntensity : number = 0 ;
6161 private _fxShakeDuration : number = 0 ;
6262 private _fxShakeComplete = null ;
63- private _fxShakeOffset : Point = new Point ( 0 , 0 ) ;
63+ private _fxShakeOffset : MicroPoint = new MicroPoint ( 0 , 0 ) ;
6464 private _fxShakeDirection : number = 0 ;
6565 private _fxShakePrevX : number = 0 ;
6666 private _fxShakePrevY : number = 0 ;
@@ -77,8 +77,8 @@ module Phaser {
7777 public ID : number ;
7878 public worldView : Rectangle ;
7979 public totalSpritesRendered : number ;
80- public scale : Point = new Point ( 1 , 1 ) ;
81- public scroll : Point = new Point ( 0 , 0 ) ;
80+ public scale : MicroPoint = new MicroPoint ( 1 , 1 ) ;
81+ public scroll : MicroPoint = new MicroPoint ( 0 , 0 ) ;
8282 public bounds : Rectangle = null ;
8383 public deadzone : Rectangle = null ;
8484
@@ -96,7 +96,7 @@ module Phaser {
9696 public showShadow : bool = false ;
9797 public shadowColor : string = 'rgb(0,0,0)' ;
9898 public shadowBlur : number = 10 ;
99- public shadowOffset : Point = new Point ( 4 , 4 ) ;
99+ public shadowOffset : MicroPoint = new MicroPoint ( 4 , 4 ) ;
100100
101101 public visible : bool = true ;
102102 public alpha : number = 1 ;
@@ -230,42 +230,34 @@ module Phaser {
230230 var w : number = this . width / 8 ;
231231 var h : number = this . height / 3 ;
232232 this . deadzone = new Rectangle ( ( this . width - w ) / 2 , ( this . height - h ) / 2 - h * 0.25 , w , h ) ;
233- console . log ( 'follow 1' ) ;
234233 break ;
235234 case Camera . STYLE_TOPDOWN :
236235 helper = Math . max ( this . width , this . height ) / 4 ;
237236 this . deadzone = new Rectangle ( ( this . width - helper ) / 2 , ( this . height - helper ) / 2 , helper , helper ) ;
238- console . log ( 'follow 2' ) ;
239237 break ;
240238 case Camera . STYLE_TOPDOWN_TIGHT :
241239 helper = Math . max ( this . width , this . height ) / 8 ;
242240 this . deadzone = new Rectangle ( ( this . width - helper ) / 2 , ( this . height - helper ) / 2 , helper , helper ) ;
243- console . log ( 'follow 3' ) ;
244241 break ;
245242 case Camera . STYLE_LOCKON :
246243 default :
247244 this . deadzone = null ;
248- console . log ( 'follow 4' ) ;
249245 break ;
250246 }
251247
252248 }
253249
254250 public focusOnXY ( x : number , y : number ) {
255251
256- console . log ( 'focusOn' , x , y ) ;
257-
258252 x += ( x > 0 ) ? 0.0000001 : - 0.0000001 ;
259253 y += ( y > 0 ) ? 0.0000001 : - 0.0000001 ;
260254
261255 this . scroll . x = Math . round ( x - this . worldView . halfWidth ) ;
262256 this . scroll . y = Math . round ( y - this . worldView . halfHeight ) ;
263257
264- console . log ( 'focusOn scroll' , this . scroll . x , this . scroll . y ) ;
265-
266258 }
267259
268- public focusOn ( point : Point ) {
260+ public focusOn ( point ) {
269261
270262 point . x += ( point . x > 0 ) ? 0.0000001 : - 0.0000001 ;
271263 point . y += ( point . y > 0 ) ? 0.0000001 : - 0.0000001 ;
@@ -291,7 +283,7 @@ module Phaser {
291283 }
292284
293285 this . bounds . setTo ( x , y , width , height ) ;
294- this . worldView . setTo ( x , y , width , height ) ;
286+
295287 this . scroll . setTo ( 0 , 0 ) ;
296288
297289 this . update ( ) ;
@@ -342,7 +334,7 @@ module Phaser {
342334
343335 }
344336
345- // Make sure we didn't go outside the camera's bounds
337+ // Make sure we didn't go outside the cameras bounds
346338 if ( this . bounds !== null )
347339 {
348340 if ( this . scroll . x < this . bounds . left )
@@ -369,6 +361,8 @@ module Phaser {
369361 this . worldView . x = this . scroll . x ;
370362 this . worldView . y = this . scroll . y ;
371363
364+ //console.log(this.worldView.width, this.worldView.height);
365+
372366 // Input values
373367 this . inputX = this . worldView . x + this . _game . input . x ;
374368 this . inputY = this . worldView . y + this . _game . input . y ;
@@ -610,9 +604,10 @@ module Phaser {
610604
611605 this . worldView . width = width ;
612606 this . worldView . height = height ;
613-
614607 this . checkClip ( ) ;
615608
609+ //console.log('Camera setSize', width, height);
610+
616611 }
617612
618613 public renderDebugInfo ( x : number , y : number , color ?: string = 'rgb(255,255,255)' ) {
@@ -652,6 +647,12 @@ module Phaser {
652647 }
653648
654649 public set width ( value : number ) {
650+
651+ if ( value > this . _game . stage . width )
652+ {
653+ value = this . _game . stage . width ;
654+ }
655+
655656 this . worldView . width = value ;
656657 this . checkClip ( ) ;
657658 }
@@ -661,6 +662,12 @@ module Phaser {
661662 }
662663
663664 public set height ( value : number ) {
665+
666+ if ( value > this . _game . stage . height )
667+ {
668+ value = this . _game . stage . height ;
669+ }
670+
664671 this . worldView . height = value ;
665672 this . checkClip ( ) ;
666673 }
0 commit comments