mirror of https://github.com/dirtbags/tanks.git
maybe fix showing cannon fire on death
This commit is contained in:
parent
ea5f37b945
commit
926de8edc1
15
tanks.js
15
tanks.js
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue