1
0
Fork 0

Add life sprite

This commit is contained in:
Ethanell 2021-03-30 09:42:18 +02:00
parent d3ddaafce9
commit 1f59aa354d
2 changed files with 32 additions and 2 deletions

View file

@ -20,3 +20,5 @@
- [x] Power up to decrease the snake size
- [x] Pause game when press escape
- [x] Sprites

View file

@ -222,8 +222,36 @@ export class Tile {
}
break;
case tiles.ORANGE:
if (!pxsize) {
this.game.ctx.fillStyle = "#ff7500";
this.game.ctx.fillRect(...canvasPos, ...size);
} else {
this.game.ctx.fillStyle = "#04c444";
this.game.ctx.fillRect(width+3*pxsize, height+2*pxsize, 6*pxsize, 2*pxsize);
this.game.ctx.fillStyle = "#ffae00";
this.game.ctx.fillRect(width+2*pxsize, height+4*pxsize, 8*pxsize, 6*pxsize);
this.game.ctx.fillStyle = "#000000";
this.game.ctx.fillRect(width+pxsize, height+5*pxsize, pxsize, 4*pxsize);
this.game.ctx.fillRect(width+10*pxsize, height+5*pxsize, pxsize, 4*pxsize);
this.game.ctx.fillRect(width+2*pxsize, height+9*pxsize, pxsize, pxsize);
this.game.ctx.fillRect(width+9*pxsize, height+9*pxsize, pxsize, pxsize);
this.game.ctx.fillRect(width+3*pxsize, height+10*pxsize, 6*pxsize, pxsize);
this.game.ctx.fillRect(width+2*pxsize, height+4*pxsize, pxsize, pxsize);
this.game.ctx.fillRect(width+9*pxsize, height+4*pxsize, pxsize, pxsize);
this.game.ctx.fillRect(width+4*pxsize, height+4*pxsize, 4*pxsize, pxsize);
this.game.ctx.fillRect(width+3*pxsize, height+3*pxsize, pxsize, pxsize);
this.game.ctx.fillRect(width+7*pxsize, height+3*pxsize, 2*pxsize, pxsize);
this.game.ctx.fillRect(width+2*pxsize, height+2*pxsize, pxsize, pxsize);
this.game.ctx.fillRect(width+5*pxsize, height+2*pxsize, pxsize, pxsize);
this.game.ctx.fillRect(width+9*pxsize, height+2*pxsize, pxsize, pxsize);
this.game.ctx.fillRect(width+3*pxsize, height+pxsize, 2*pxsize, pxsize);
this.game.ctx.fillRect(width+6*pxsize, height+pxsize, 3*pxsize, pxsize);
}
break;
}