xxxxxxxxxx
30
let cols = 1; let rows = 1; let size = 100;
let blocks = [];
function setup() {
createCanvas(400, 400);
for (let i=0; i<cols; i++) {
blocks[i] = [];
for (let j=0; j<rows; j++) {
if ((i+j)%2 == 0) {
blocks[i][j] = new Block(i*size, j*size, size, 4, 0.1);
} else {
blocks[i][j] = new Block(i*size, j*size, size, 10, 0.1);
}
}
}
}
function draw() {
background(0, 0, 100);
push();
// translate((width - size*cols)/2, (height - size*rows)/2);
for (let i=0; i<cols; i++) {
for (let j=0; j<rows; j++) {
blocks[i][j].display();
}
}
pop();
// fill(255, 0, 0);
// ellipse(width/2, height/2, 10, 10);
}