Index: pycodeshooter/trunk/shooter/bullet.js
===================================================================
--- pycodeshooter/trunk/shooter/bullet.js	(revision 105)
+++ pycodeshooter/trunk/shooter/bullet.js	(revision 106)
@@ -14,7 +14,8 @@
  */
 
-var Bullet = function(size, color, x, y, dir, speed) {
+var Bullet = function(size, color, frame, x, y, dir, speed) {
     this.size  = size;
     this.color = color;
+    this.frame = frame;
     this.x     = x;
     this.y     = y;
@@ -22,5 +23,39 @@
     this.speed = speed;
 
+    this.getSize = function() {
+        return this.size;
+    };
+    this.getColor = function() {
+        return this.color;
+    };
+    this.next = function() {
+        var pos = this.calcNext();
+        this.x = pos[0];
+        this.y = pos[1];
+    };
+    this.vanished = function(width, height) {
+        return (width < this.x || height < this.y || this.x < 0 || this.y < 0);
+    };
     this.draw = function(ctx) {
+        if (this.frame) {
+            var pos = this.calcNext();
+            var dir = Math.atan2(pos[0] - this.x, this.y - pos[1]);
+
+            ctx.save();
+
+            if (this.frame.style == "rect") {
+                ctx.beginPath();
+                ctx.strokeStyle = this.frame.color;
+                ctx.translate(this.x, this.y);
+                ctx.rotate(dir);
+                ctx.rect(-this.frame.width / 2, -this.frame.height / 2,
+                         this.frame.width, this.frame.height);
+                ctx.stroke();
+                ctx.closePath();
+            }
+
+            ctx.restore();
+        }
+
         ctx.beginPath();
         ctx.fillStyle = this.getColor();
@@ -29,24 +64,14 @@
         ctx.closePath();
     };
-    this.vanished = function(width, height) {
-        return (width < this.x || height < this.y || this.x < 0 || this.y < 0);
-    };
-    this.getSize = function() {
-        return this.size;
-    };
-    this.getColor = function() {
-        return this.color;
-    };
 };
 
-var LinerBullet = function(size, color, x, y, dir, speed) {
-    var that = new Bullet(size, color, x, y, dir, speed);
+var LinerBullet = function(size, color, frame, x, y, dir, speed) {
+    var that = new Bullet(size, color, frame, x, y, dir, speed);
 
     that.deltaBaseX = Math.cos(that.dir);
     that.deltaBaseY = Math.sin(that.dir);
 
-    that.next = function() {
-        this.x += this.getDeltaX();
-        this.y += this.getDeltaY();
+    that.calcNext = function() {
+        return [this.x + this.getDeltaX(), this.y + this.getDeltaY()];
     };
     that.getDeltaX = function() {
@@ -60,6 +85,6 @@
 };
 
-var AxisExtendBullet = function(size, color, x, y, dir, speed) {
-    var that = new LinerBullet(size, color, x, y, dir, speed);
+var AxisExtendBullet = function(size, color, frame, x, y, dir, speed) {
+    var that = new LinerBullet(size, color, frame, x, y, dir, speed);
 
     that.dx = that.speed * that.deltaBaseX / 1.5;
@@ -80,6 +105,6 @@
 };
 
-var XYExtendBullet = function(size, color, x, y, dir, speed) {
-    var that = new AxisExtendBullet(size, color, x, y, dir, speed);
+var XYExtendBullet = function(size, color, frame, x, y, dir, speed) {
+    var that = new AxisExtendBullet(size, color, frame, x, y, dir, speed);
 
     that.i = 1;
@@ -94,6 +119,6 @@
 };
 
-var XExtendBullet = function(size, color, x, y, dir, speed) {
-    var that = new AxisExtendBullet(size, color, x, y, dir, speed);
+var XExtendBullet = function(size, color, frame, x, y, dir, speed) {
+    var that = new AxisExtendBullet(size, color, frame, x, y, dir, speed);
 
     that.i = 1;
@@ -108,6 +133,6 @@
 };
 
-var YExtendBullet = function(size, color, x, y, dir, speed) {
-    var that = new AxisExtendBullet(size, color, x, y, dir, speed);
+var YExtendBullet = function(size, color, frame, x, y, dir, speed) {
+    var that = new AxisExtendBullet(size, color, frame, x, y, dir, speed);
 
     that.i = 1;
@@ -122,15 +147,16 @@
 };
 
-var CurveBullet = function(size, color, x, y, dir, speed) {
-    var that = new Bullet(size, color, x, y, dir, speed);
+var CurveBullet = function(size, color, frame, x, y, dir, speed) {
+    var that = new Bullet(size, color, frame, x, y, dir, speed);
 
     that.delta = 1 / (that.speed * 100);
     that.i     = 1;
 
-    that.next = function() {
-        this.x   += Math.cos(this.dir) * this.i;
-        this.y   += Math.sin(this.dir) * this.i;
+    that.calcNext = function() {
+        var x = this.x + Math.cos(this.dir) * this.i;
+        var y = this.y + Math.sin(this.dir) * this.i;
         this.dir += (this.delta / this.i) * this.getSign();
         this.i   += (this.delta / this.i);
+        return [x, y];
     };
 
@@ -138,6 +164,6 @@
 };
 
-var LeftCurveBullet = function(size, color, x, y, dir, speed) {
-    var that = new CurveBullet(size, color, x, y, dir, speed);
+var LeftCurveBullet = function(size, color, frame, x, y, dir, speed) {
+    var that = new CurveBullet(size, color, frame, x, y, dir, speed);
 
     that.getSign = function() {
@@ -148,6 +174,6 @@
 };
 
-var RightCurveBullet = function(size, color, x, y, dir, speed) {
-    var that = new CurveBullet(size, color, x, y, dir, speed);
+var RightCurveBullet = function(size, color, frame, x, y, dir, speed) {
+    var that = new CurveBullet(size, color, frame, x, y, dir, speed);
 
     that.getSign = function() {
