import PIXI from 'pixi.js';
import Tile from '../Tile';
import Loader from 'utils/Loader';

export default class TowerLayer extends PIXI.Container {
  constructor(width, height, tileSize) {
    super();
    console.log('towerLayer');
    this.tileSize = tileSize;
    this.populate(width, height);
  }

  populate(width, height) {
    const nbCols = Math.floor(width / this.tileSize);
    const cols = Math.floor(nbCols / 3);
    const nbRaws = Math.floor(height / this.tileSize);
    const raws = Math.floor(nbRaws / 3);

    for (let x = cols; x < nbCols - cols; x++) {
      for (let y = raws; y < nbRaws - raws; y++) {
        this.addChild(new Tile(x * this.tileSize, y * this.tileSize, Loader.getTexture('ennemy')));
      }
    }
  }
}

@@ -42,16 +42,21 @@
 rom '../
+tile/
 Tile';%0Ai
@@ -205,38 +205,8 @@
 ();%0A
-    console.log('towerLayer');
 %0A   
@@ -231,24 +231,27 @@
 ileSize;%0A   
+ //
  this.popula
@@ -280,439 +280,132 @@
 %0A%0A  
-populate(width, height
+addTower(x, y
 ) %7B%0A
+%0A
     
-const nbCols = Math.floor(width / this.tileSize);%0A    const cols = Math.floor(nbCols / 3);%0A    const nbRaws = Math.floor(height / this.tileSize);%0A    const raws = Math.floor(nbRaws / 3);%0A%0A    for (let x = cols; x %3C nbCols - cols; x++) %7B%0A      for (let y = raws; y %3C nbRaws - raws; y++) %7B%0A        this.addChild(new Tile(x * this.tileSize, y * this.tileSize, Loader.getTexture('ennemy')));%0A      %7D%0A    %7D
+// TODO Trouver la case correspondante au X, Y pass%C3%A9 en param%C3%A8tre et addChild la Tower correspondante%0A
 %0A  %7D

Add TowerLayer