34 lines
1006 B
JavaScript
34 lines
1006 B
JavaScript
import Barco,{BarcoTipo} from "./Barco.js";
|
|
import Mapa from "./Mapa.js";
|
|
|
|
class PartidaBattle {
|
|
barcos = [];
|
|
casillaSize = 32;
|
|
numFilas = 10;
|
|
numColumnas = 10;
|
|
|
|
constructor() {
|
|
this.mapaAtaque=new Mapa();
|
|
this.mapaFlota=new Mapa();
|
|
this.barcos.push(
|
|
new Barco(0,0,BarcoTipo.PORTAAVIONES,'VERTICAL'),
|
|
new Barco(1,0,BarcoTipo.ACORAZADO,'VERTICAL'),
|
|
new Barco(2,0,BarcoTipo.ACORAZADO,'VERTICAL'),
|
|
new Barco(3,0,BarcoTipo.ACORAZADO,'VERTICAL'),
|
|
new Barco(4,0,BarcoTipo.DESTRUCTOR,'VERTICAL'),
|
|
new Barco(5,0,BarcoTipo.DESTRUCTOR,'VERTICAL'),
|
|
new Barco(6,0,BarcoTipo.DESTRUCTOR,'VERTICAL'),
|
|
new Barco(7,0,BarcoTipo.FRAGATA,'VERTICAL'),
|
|
new Barco(8,0,BarcoTipo.FRAGATA,'VERTICAL'));
|
|
}
|
|
|
|
draw(ctxMapa, ctxMiniMapa){
|
|
this.mapaAtaque.draw(ctxMapa);
|
|
this.mapaFlota.draw(ctxMiniMapa);
|
|
this.barcos.forEach((barco)=>{
|
|
barco.draw(ctxMapa);
|
|
})
|
|
}
|
|
|
|
}
|
|
export default PartidaBattle; |