Index: pycodeshooter/trunk/shooter/action.js
===================================================================
--- pycodeshooter/trunk/shooter/action.js	(revision 103)
+++ pycodeshooter/trunk/shooter/action.js	(revision 108)
@@ -104,5 +104,5 @@
 
     that.index = 0;
-    that.shot  = function(trooper, enemy) {
+    that.shot  = function(trooper, enemies) {
         if (isSetSwitch(SWITCH_BULLET)) {
             if (++this.index >= trooper.barrages.length)
@@ -115,5 +115,5 @@
         }
         if (isInAction(ACTION_SHOT))
-            trooper.barrages[this.index].update(trooper, enemy);
+            trooper.barrages[this.index].update(trooper, enemies);
     };
 
@@ -125,6 +125,6 @@
 
     that.index = 0;
-    that.shot  = function(trooper, enemy) {
-        if (trooper.barrages[this.index].update(trooper, enemy))
+    that.shot  = function(trooper, enemies) {
+        if (trooper.barrages[this.index].update(trooper, enemies))
             this.index = Math.floor(Math.random() * trooper.barrages.length);
     };
@@ -140,6 +140,6 @@
 
     that.i    = 0;
-    that.shot = function(trooper, enemy) {
-        if (trooper.barrages[this.index].update(trooper, enemy)) {
+    that.shot = function(trooper, enemies) {
+        if (trooper.barrages[this.index].update(trooper, enemies)) {
             if (++this.i > count) {
                 this.index++;
@@ -169,11 +169,11 @@
 var Action = function(shot) {
     this.shot   = shot;
-    this.update = function(trooper, enemy) {
+    this.update = function(trooper, enemies) {
         if (trooper.isDead())
             return;
-        this.shot.shot(trooper, enemy);
-        return this.move(trooper, enemy);
-    };
-    this.move = function(trooper, enemy) {
+        this.shot.shot(trooper, enemies);
+        return this.move(trooper, enemies);
+    };
+    this.move = function(trooper, enemies) {
         return true;
     };
@@ -183,5 +183,5 @@
     var that = new Action(shot);
 
-    that.move = function(trooper, enemy) {
+    that.move = function(trooper, enemies) {
         var x = 0;
         var y = 0;
@@ -216,13 +216,13 @@
     that.resolution = 0;
 
-    that.move = function(trooper, enemy) {
+    that.move = function(trooper, enemies) {
         if (this.count >= this.resolution) {
             this.count      = 0;
             this.resolution = resolution / trooper.speed;
 
-            this.p0 = this.getPoint0(trooper, enemy);
-            this.p1 = this.getPoint1(trooper, enemy);
-            this.p2 = this.getPoint2(trooper, enemy);
-            this.p3 = this.getPoint3(trooper, enemy);
+            this.p0 = this.getPoint0(trooper, enemies);
+            this.p1 = this.getPoint1(trooper, enemies);
+            this.p2 = this.getPoint2(trooper, enemies);
+            this.p3 = this.getPoint3(trooper, enemies);
         }
 
@@ -254,16 +254,16 @@
     var that = new BezierAction(shot, resolution);
 
-    that.getPoint0 = function(trooper, enemy) {
+    that.getPoint0 = function(trooper, enemies) {
         return [trooper.x, trooper.y];
     };
-    that.getPoint1 = function(trooper, enemy) {
+    that.getPoint1 = function(trooper, enemies) {
         return [trooper.x - (trooper.speed * 10),
                 trooper.y + (trooper.speed * 10)];
     };
-    that.getPoint2 = function(trooper, enemy) {
+    that.getPoint2 = function(trooper, enemies) {
         return [trooper.x + (trooper.speed * 10),
                 trooper.y + (trooper.speed * 10)];
     };
-    that.getPoint3 = function(trooper, enemy) {
+    that.getPoint3 = function(trooper, enemies) {
         return [trooper.x, trooper.y];
     };
@@ -275,16 +275,16 @@
     var that = new BezierAction(shot, resolution);
 
-    that.getPoint0 = function(trooper, enemy) {
+    that.getPoint0 = function(trooper, enemies) {
         return [trooper.x, trooper.y];
     };
-    that.getPoint1 = function(trooper, enemy) {
+    that.getPoint1 = function(trooper, enemies) {
         return [Math.floor(Math.random() * trooper.w),
                 Math.floor(Math.random() * trooper.h)];
     };
-    that.getPoint2 = function(trooper, enemy) {
+    that.getPoint2 = function(trooper, enemies) {
         return [Math.floor(Math.random() * trooper.w),
                 Math.floor(Math.random() * trooper.h)];
     };
-    that.getPoint3 = function(trooper, enemy) {
+    that.getPoint3 = function(trooper, enemies) {
         return [Math.floor(Math.random() * trooper.w),
                 Math.floor(Math.random() * trooper.h)];
@@ -297,5 +297,5 @@
     var that = new RandomAction(shot, resolution);
 
-    that.getPoint3 = function(trooper, enemy) {
+    that.getPoint3 = function(trooper, enemies) {
         return [Math.floor(Math.random() * trooper.w), trooper.y];
     };
@@ -307,6 +307,7 @@
     var that = new RandomAction(shot, resolution);
 
-    that.getPoint3 = function(trooper, enemy) {
-        return [enemy.x, Math.floor(Math.random() * trooper.h)];
+    that.getPoint3 = function(trooper, enemies) {
+        var x = enemies.length ? enemies[0].x : 0;
+        return [x, Math.floor(Math.random() * trooper.h)];
     };
 
@@ -317,6 +318,7 @@
     var that = new RandomAction(shot, resolution);
 
-    that.getPoint3 = function(trooper, enemy) {
-        return [enemy.x, trooper.y];
+    that.getPoint3 = function(trooper, enemies) {
+        var x = enemies.length ? enemies[0].x : 0;
+        return [x, trooper.y];
     };
 
@@ -332,9 +334,9 @@
     this.list   = list;
     this.index  = 0;
-    this.update = function(trooper, enemy) {
-        this.updateIdx(this.list[this.index].update(trooper, enemy),
-                       trooper, enemy);
-    };
-    this.updateIdx = function(end, trooper, enemy) {
+    this.update = function(trooper, enemies) {
+        this.updateIdx(this.list[this.index].update(trooper, enemies),
+                       trooper, enemies);
+    };
+    this.updateIdx = function(end, trooper, enemies) {
         this.index = 0;
     };
@@ -344,5 +346,5 @@
     var that = new ActionList(list);
 
-    that.updateIdx = function(end, trooper, enemy) {
+    that.updateIdx = function(end, trooper, enemies) {
         if (end)
             this.index = Math.floor(Math.random() * this.list.length);
@@ -359,5 +361,5 @@
 
     that.i         = 0;
-    that.updateIdx = function(end, trooper, enemy) {
+    that.updateIdx = function(end, trooper, enemies) {
         if (end) {
             if (++this.i > count) {
@@ -385,5 +387,5 @@
 
     that.life      = 0;
-    that.updateIdx = function(end, trooper, enemy) {
+    that.updateIdx = function(end, trooper, enemies) {
         if (!this.life)
             this.life = trooper.life;
@@ -402,5 +404,5 @@
 
     that.life      = 0;
-    that.updateIdx = function(end, trooper, enemy) {
+    that.updateIdx = function(end, trooper, enemies) {
         if (!this.life)
             this.life = trooper.life;
