maybe fix showing cannon fire on death

This commit is contained in:
Alyssa Milburn 2014-07-30 01:25:29 +02:00
parent ea5f37b945
commit 926de8edc1
1 changed files with 10 additions and 5 deletions

View File

@ -62,11 +62,7 @@ function Tank(ctx, width, height, color, sensors) {
if (!this.dead) {
return;
}
if (this.fire == 5) {
// one frame of cannon fire
this.draw_cannon();
this.fire = 0;
}
var points = 7;
var angle = Math.PI / points;
@ -74,6 +70,15 @@ function Tank(ctx, width, height, color, sensors) {
ctx.translate(this.x, this.y);
ctx.rotate(this.rotation);
if (this.fire == 5) {
ctx.save();
ctx.rotate(this.turret);
// one frame of cannon fire
this.draw_cannon();
this.fire = 0;
ctx.restore();
}
ctx.lineWidth = 2;
ctx.strokeStyle = craterStroke;
ctx.fillStyle = craterFill;