/*global game,Phaser*/
var state = {};

var enemy, shots;

state.create = function() {
    shots = game.add.group();
    var background = game.add.tileSprite(0, 0, 800, 600, 'starfield');
    background.update = function() {
        this.tilePosition.y += 1200 * game.time.physicsElapsed;
    };
    var ship = game.add.sprite(0, 0, 'ship');
    game.physics.arcade.enable(ship);
    ship.anchor.set(0.5);
    ship.scale.set(0.4);
    ship.shotTimer = 0;
    ship.update = function() {
        ship.body.velocity.set(0);
        if (game.physics.arcade.distanceToPointer(ship) > 10)
            game.physics.arcade.moveToPointer(ship, 300);
        if ((this.shotTimer += game.time.physicsElapsed) >= .25) {
            this.shotTimer = 0;
            var shot = game.make.sprite(this.x, this.y, 'pix');
            shot.height = 8;
            shot.width = 4;
            shot.anchor.set(0.5);
            shot.tint = 0x00ff00;
            game.physics.arcade.enable(shot);
            shot.body.velocity.y = -600;
            shots.add(shot);
        }
    };

    enemy = game.add.sprite(0, 0, 'pix');
    enemy.height = enemy.width = 40;
    enemy.anchor.set(0.5);
    game.physics.arcade.enable(enemy);
    enemy.x = 300;
    enemy.y = 50;
    game.add.tween(enemy).to({
        y: 300,
        x: 500
    }, 2000, Phaser.Easing.Sinusoidal.InOut, true, 0, -1, true);
};

state.update = function() {
    game.physics.arcade.overlap(enemy, shots, function(enemy, shot) {
        shot.kill();
    });
};

module.exports = state;
@@ -37,25 +37,27 @@
 %7D;%0A%0Avar enem
-y
+ies
 , shots;%0A%0Ast
@@ -107,17 +107,63 @@
 add.
-g
+physicsGroup();%0A    enemies = game.add.physicsG
 roup();%0A
     
@@ -154,24 +154,25 @@
 icsGroup();%0A
+%0A
     var back
@@ -625,10 +625,9 @@
 ) %3E 
-10
+5
 )%0A  
@@ -797,16 +797,217 @@
     var 
+shot;%0A            if ((shot = shots.getFirstDead())) %7B%0A                shot.x = this.x;%0A                shot.y = this.y;%0A                shot.revive();%0A            %7D%0A            else %7B%0A                
 shot = g
@@ -1054,24 +1054,28 @@
             
+ 
+   
 shot.height 
@@ -1087,24 +1087,28 @@
             
+    
 shot.width =
@@ -1111,16 +1111,20 @@
 th = 4;%0A
+    
         
@@ -1157,24 +1157,28 @@
             
+    
 shot.tint = 
@@ -1203,42 +1203,120 @@
     
-game.physics.arcade.enable
+    shot.checkWorldBounds = true;%0A                shot.outOfBoundsKill = true;%0A                shots.add
 (shot);%0A
     
@@ -1303,32 +1303,36 @@
 hots.add(shot);%0A
+    
             shot
@@ -1368,32 +1368,17 @@
         
-shots.add(shot);
+%7D
 %0A       
@@ -1388,24 +1388,28 @@
     %7D;%0A%0A    
+var 
 enemy = game
@@ -1401,35 +1401,36 @@
 ar enemy = game.
-add
+make
 .sprite(0, 0, 'p
@@ -1503,47 +1503,8 @@
 5);%0A
-    game.physics.arcade.enable(enemy);%0A
     
@@ -1663,16 +1663,40 @@
  true);%0A
+    enemies.add(enemy);%0A
 %7D;%0A%0Astat
@@ -1751,25 +1751,27 @@
 overlap(enem
-y
+ies
 , shots, fun

Implement shot pooling.