p5-breakout/tile.js

24 lines
494 B
JavaScript

//TILE CLASS. PUTS ALL THE BLOCKS IN A GRID AND GIVES THEM PROPERTIES.
class Tile {
constructor(i, j, colors) {
this.i = i;
this.j = j;
this.colors = colors
this.x = i * width / 13;
this.y = j * width / 64;
this.score = score
}
show() {
stroke(0);
fill(this.colors);
rect(this.x, this.y, width / 13, width / 64, 10);
}
colorRows(colors) {
this.colors = colors
return colors;
}
}