BattleShip/oceano.js
2024-03-27 13:42:31 +01:00

22 lines
524 B
JavaScript

class Oceano {
constructor(width, height, celdaSize, sprites) {
this.sprites = sprites;
this.celdaSize = celdaSize;
this.filas = Math.floor(height / celdaSize);
this.columnas = Math.floor(width / celdaSize);
}
update() {}
draw(ctx) {
for (let y = 0; y < this.filas; y++) {
ctx.drawImage(this.sprites[1], y * this.celdaSize, 0);
ctx.drawImage(this.sprites[6], y * this.celdaSize, (this.columnas-1)*32)
}
for (let x = 0; x < this.filas; x++) {}
}
}
export default Oceano;