Add life sprite
This commit is contained in:
parent
d3ddaafce9
commit
1f59aa354d
2 changed files with 32 additions and 2 deletions
|
@ -20,3 +20,5 @@
|
||||||
- [x] Power up to decrease the snake size
|
- [x] Power up to decrease the snake size
|
||||||
|
|
||||||
- [x] Pause game when press escape
|
- [x] Pause game when press escape
|
||||||
|
|
||||||
|
- [x] Sprites
|
||||||
|
|
|
@ -222,8 +222,36 @@ export class Tile {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case tiles.ORANGE:
|
case tiles.ORANGE:
|
||||||
this.game.ctx.fillStyle = "#ff7500";
|
if (!pxsize) {
|
||||||
this.game.ctx.fillRect(...canvasPos, ...size);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue