diff --git a/sources/js/Game.js b/sources/js/Game.js index e728d9a..f1b7b03 100644 --- a/sources/js/Game.js +++ b/sources/js/Game.js @@ -235,7 +235,7 @@ export class Game { * Handel the live generation */ lifeGenerator() { - if (!this.world.find(v => v === tiles.LIFE)) { + if (!this.world.find(v => v === tiles.LIFE) && !this.world.find(v => v === tiles.ORANGE)) { if (this.lifeCooldown <= 0) { if (this.lives < 3 && Math.random() < 0.15) { let pos = this.randCoords(); @@ -252,7 +252,7 @@ export class Game { * Handel the orange generation */ orangeGenerator() { - if (!this.world.find(v => v === tiles.ORANGE)) { + if (!this.world.find(v => v === tiles.ORANGE) && !this.world.find(v => v === tiles.LIFE)) { if (this.orangeCooldown <= 0) { if (Math.random() < 0.05) { let pos = this.randCoords(); diff --git a/sources/js/Tile.js b/sources/js/Tile.js index b3da897..96cd92e 100644 --- a/sources/js/Tile.js +++ b/sources/js/Tile.js @@ -187,8 +187,39 @@ export class Tile { } break; case tiles.LIFE: - this.game.ctx.fillStyle = "#e400ff"; - this.game.ctx.fillRect(...canvasPos, ...size); + if (!pxsize) { + this.game.ctx.fillStyle = "#e400ff"; + this.game.ctx.fillRect(...canvasPos, ...size); + } else { + this.game.ctx.fillStyle = "#ff0000"; + + this.game.ctx.fillRect(width+pxsize, height+3*pxsize, 10*pxsize, 4*pxsize); + this.game.ctx.fillRect(width+3*pxsize, height+7*pxsize, 6*pxsize, 2*pxsize); + this.game.ctx.fillRect(width+2*pxsize, height+2*pxsize, 2*pxsize, pxsize); + this.game.ctx.fillRect(width+8*pxsize, height+2*pxsize, 2*pxsize, pxsize); + this.game.ctx.fillRect(width+5*pxsize, height+9*pxsize, 2*pxsize, pxsize); + + this.game.ctx.fillStyle = "#000000"; + + this.game.ctx.fillRect(width, height+3*pxsize, pxsize, 3*pxsize); + this.game.ctx.fillRect(width+11*pxsize, height+3*pxsize, pxsize, 3*pxsize); + this.game.ctx.fillRect(width+10*pxsize, height+2*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+pxsize, height+2*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+2*pxsize, height+pxsize, 2*pxsize, pxsize); + this.game.ctx.fillRect(width+4*pxsize, height+2*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+5*pxsize, height+3*pxsize, 2*pxsize, pxsize); + this.game.ctx.fillRect(width+7*pxsize, height+2*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+8*pxsize, height+pxsize, 2*pxsize, pxsize); + this.game.ctx.fillRect(width+pxsize, height+6*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+2*pxsize, height+7*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+3*pxsize, height+8*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+4*pxsize, height+9*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+5*pxsize, height+10*pxsize, 2*pxsize, pxsize); + this.game.ctx.fillRect(width+7*pxsize, height+9*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+8*pxsize, height+8*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+9*pxsize, height+7*pxsize, pxsize, pxsize); + this.game.ctx.fillRect(width+10*pxsize, height+6*pxsize, pxsize, pxsize); + } break; case tiles.ORANGE: this.game.ctx.fillStyle = "#ff7500";