xxxxxxxxxx
const gCubes = [];
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
const cube = gCubes[0];
if (P5tId.ColorTileMat.isOnMat(cube?.x, cube?.y)) {
background('red');
} else if (P5tId.SimpleTileMat.isOnMat(cube?.x, cube?.y)) {
// Partially, this mat overlaps with Ring Mat.
background('blue');
} else{
background(220);
}
}
function mouseClicked() {
P5tCube.connectNewP5tCube().then(cube => {
cube.turnLightOn('white');
gCubes.push(cube);
});
}