@@ -3,31 +3,22 @@ game.Entities.Weapons = game.Entities.Weapons || {};
33
44game . Entities . Weapons . Shotgun = me . Entity . extend ( {
55 init ( x , y , amount = 3 ) {
6- this . _super ( me . Entity , 'init' , [ x , y , { width : game . Entities . Weapons . Shotgun . width , height : game . Entities . Weapons . Shotgun . height } ] ) ;
7- this . body . setVelocity ( 0 , 35 ) ;
8- this . body . collisionType = me . collision . types . PROJECTILE_OBJECT ;
6+ this . _super ( me . Entity , 'init' , [ x , y , { width : 0 , height : 0 } ] ) ;
97
10- this . amount = amount ;
11- this . renderable = new ( me . Renderable . extend ( {
12- init ( ) {
13- this . _super ( me . Renderable , 'init' , [ 0 , 0 , game . Entities . Weapons . Shotgun . width , game . Entities . Weapons . Shotgun . height ] ) ;
14- } ,
15- destroy ( ) { }
16- } ) ) ( ) ;
8+ this . split ( this . pos . x , this . pos . y , amount ) ;
179 me . audio . play ( 'fire' ) ;
1810 } ,
1911 update ( ) {
2012 me . game . world . removeChild ( this ) ;
21- this . split ( this . pos . x , this . pos . y ) ;
2213 return true ;
2314 } ,
24- split ( x , y ) {
25- const { damage } = game . Entities . Weapons . Shotgun ;
15+ split ( x , y , amount ) {
16+ const { damage } = game . data . weapons [ 0 ] ;
2617
2718 me . game . world . addChild ( me . pool . pull ( 'laser' , x , y - 5 , 'n' , damage ) ) ;
2819
2920 let addToRight = true ;
30- for ( let i = 1 , amountFired = 1 ; amountFired < this . amount ; amountFired += 1 ) {
21+ for ( let i = 1 , amountFired = 1 ; amountFired < amount ; amountFired += 1 ) {
3122 if ( addToRight ) {
3223 me . game . world . addChild ( me . pool . pull ( 'laser' , x + i * 5 , y - 5 - i * 3 , 'n' , damage ) ) ;
3324 } else {
@@ -39,7 +30,3 @@ game.Entities.Weapons.Shotgun = me.Entity.extend({
3930 }
4031 }
4132} ) ;
42-
43- game . Entities . Weapons . Shotgun . damage = game . data . weapons [ 0 ] . damage ;
44- game . Entities . Weapons . Shotgun . width = 3 ;
45- game . Entities . Weapons . Shotgun . height = 20 ;
0 commit comments