@@ -25,24 +25,24 @@ import { FSprite } from './sprite/FSprite'
2525 * ``` 
2626 */ 
2727export  class  FScene2d  extends  FScene  { 
28-   components : FComponent2d [ ] 
28+   // Components can be declared as it will be initialized by the parent class 
29+   declare  components : FComponent2d [ ] 
2930  // Pixi.js 
3031  app : PIXI . Application 
3132  viewport ?: Viewport 
3233  // Rapier 
3334  gravity : {  x : number ,  y : number ,  z : number  }  =  {  x : 0 ,  y : - 9.81 ,  z : 0  } 
3435  declare  world ?: World 
3536  declare  eventQueue : RAPIER . EventQueue 
36-   rapierToComponent : Map < number ,  FComponent2d >  =  new  Map ( ) 
37+   __RAPIER_TO_COMPONENT__ : Map < number ,  FComponent2d >  =  new  Map ( ) 
3738  // onReadyCallbacks 
3839  public  onReadyCallbacks : ( ( )  =>  void ) [ ]  =  [ ] 
3940  // Debug 
4041  DEBUG_LINES : PIXI . Graphics [ ]  =  [ ] 
41-   DEBUG_MODE : boolean  =  false 
42+   __DEBUG_MODE__ : boolean  =  false 
4243
4344  constructor ( options : {  debug ?: boolean  }  =  {  debug : false  } )  { 
4445    super ( ) 
45-     this . components  =  [ ] 
4646
4747    // Verify window and document are available 
4848    if  ( typeof  window  ===  'undefined'  ||  typeof  document  ===  'undefined' ) 
@@ -52,7 +52,7 @@ export class FScene2d extends FScene {
5252    this . app  =  new  PIXI . Application ( ) 
5353
5454    // Store the debug mode 
55-     this . DEBUG_MODE  =  options . debug  ||  false 
55+     this . __DEBUG_MODE__  =  options . debug  ||  false 
5656  } 
5757
5858  /** 
@@ -104,7 +104,7 @@ export class FScene2d extends FScene {
104104    this . viewport . setZoom ( 0.8 ,  true ) 
105105
106106    // Add help grid 
107-     if  ( this . DEBUG_MODE )  { 
107+     if  ( this . __DEBUG_MODE__ )  { 
108108      const  helpGrid  =  new  PIXI . Graphics ( ) 
109109      // Draw the grid 
110110      for  ( let  i  =  - 1000 ;  i  <=  1000 ;  i  +=  100 )  { 
@@ -132,7 +132,7 @@ export class FScene2d extends FScene {
132132      } ) 
133133
134134      // Debug 
135-       if  ( this . DEBUG_MODE ) 
135+       if  ( this . __DEBUG_MODE__ ) 
136136        this . debug ( ) 
137137    } ) 
138138
@@ -175,8 +175,8 @@ export class FScene2d extends FScene {
175175   */ 
176176  handleCollision ( handle1 : RAPIER . ColliderHandle ,  handle2 : RAPIER . ColliderHandle ,  start : boolean )  { 
177177    // Get the components from the handles 
178-     const  collider1  =  this . rapierToComponent . get ( handle1 ) 
179-     const  collider2  =  this . rapierToComponent . get ( handle2 ) 
178+     const  collider1  =  this . __RAPIER_TO_COMPONENT__ . get ( handle1 ) 
179+     const  collider2  =  this . __RAPIER_TO_COMPONENT__ . get ( handle2 ) 
180180    // If both colliders are undefined, return 
181181    if  ( collider1  ===  undefined  &&  collider2  ===  undefined ) 
182182      return 
@@ -200,7 +200,7 @@ export class FScene2d extends FScene {
200200  } 
201201
202202  addComponent ( component : FComponent2d )  { 
203-     this . components . push ( component ) 
203+     super . addComponent ( component ) 
204204
205205    // Detect if the FComponent2d is a FSprite instance 
206206    if  ( component  instanceof  FSprite )  { 
@@ -216,9 +216,9 @@ export class FScene2d extends FScene {
216216          this . viewport ?. addChild ( component . container ) 
217217        } 
218218
219-         // If a collider is defined, add it's handle to the rapierToComponent  map 
219+         // If a collider is defined, add it's handle to the __RAPIER_TO_COMPONENT__  map 
220220        if  ( component . collider ?. handle  !==  undefined ) 
221-           this . rapierToComponent . set ( component . collider ?. handle ,  component ) 
221+           this . __RAPIER_TO_COMPONENT__ . set ( component . collider ?. handle ,  component ) 
222222      } ) 
223223    } 
224224    else  { 
@@ -234,9 +234,9 @@ export class FScene2d extends FScene {
234234      } 
235235    } 
236236
237-     // If a collider is defined, add it's handle to the rapierToComponent  map 
237+     // If a collider is defined, add it's handle to the __RAPIER_TO_COMPONENT__  map 
238238    if  ( component . collider ?. handle  !==  undefined ) 
239-       this . rapierToComponent . set ( component . collider ?. handle ,  component ) 
239+       this . __RAPIER_TO_COMPONENT__ . set ( component . collider ?. handle ,  component ) 
240240  } 
241241
242242  onReady ( callback : ( )  =>  void )  { 
0 commit comments