11var ArcadeImage = require ( './ArcadeImage' ) ;
22var ArcadeSprite = require ( './ArcadeSprite' ) ;
33var Class = require ( '../../utils/Class' ) ;
4- var PhysicsGroup = require ( './PhysicsGroup' ) ;
54var CONST = require ( './const' ) ;
5+ var PhysicsGroup = require ( './PhysicsGroup' ) ;
6+ var StaticPhysicsGroup = require ( './StaticPhysicsGroup' ) ;
67
78var Factory = new Class ( {
89
@@ -19,42 +20,55 @@ var Factory = new Class({
1920
2021 staticImage : function ( x , y , key , frame )
2122 {
22- var image = new ArcadeImage ( this . scene , CONST . STATIC_BODY , x , y , key , frame ) ;
23+ var image = new ArcadeImage ( this . scene , x , y , key , frame ) ;
2324
2425 this . sys . displayList . add ( image ) ;
2526
27+ this . world . enableBody ( image , CONST . STATIC_BODY ) ;
28+
2629 return image ;
2730 } ,
2831
2932 image : function ( x , y , key , frame )
3033 {
31- var image = new ArcadeImage ( this . scene , CONST . DYNAMIC_BODY , x , y , key , frame ) ;
34+ var image = new ArcadeImage ( this . scene , x , y , key , frame ) ;
3235
3336 this . sys . displayList . add ( image ) ;
3437
38+ this . world . enableBody ( image , CONST . DYNAMIC_BODY ) ;
39+
3540 return image ;
3641 } ,
3742
3843 staticSprite : function ( x , y , key , frame )
3944 {
40- var sprite = new ArcadeSprite ( this . scene , CONST . STATIC_BODY , x , y , key , frame ) ;
45+ var sprite = new ArcadeSprite ( this . scene , x , y , key , frame ) ;
4146
4247 this . sys . displayList . add ( sprite ) ;
4348 this . sys . updateList . add ( sprite ) ;
4449
50+ this . world . enableBody ( sprite , CONST . STATIC_BODY ) ;
51+
4552 return sprite ;
4653 } ,
4754
4855 sprite : function ( x , y , key , frame )
4956 {
50- var sprite = new ArcadeSprite ( this . scene , CONST . DYNAMIC_BODY , x , y , key , frame ) ;
57+ var sprite = new ArcadeSprite ( this . scene , x , y , key , frame ) ;
5158
5259 this . sys . displayList . add ( sprite ) ;
5360 this . sys . updateList . add ( sprite ) ;
5461
62+ this . world . enableBody ( sprite , CONST . DYNAMIC_BODY ) ;
63+
5564 return sprite ;
5665 } ,
5766
67+ staticGroup : function ( children , config )
68+ {
69+ return new StaticPhysicsGroup ( this . world , this . world . scene , children , config ) ;
70+ } ,
71+
5872 group : function ( children , config )
5973 {
6074 return new PhysicsGroup ( this . world , this . world . scene , children , config ) ;
0 commit comments