xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
background(220);
}
const connectedCubeArray = [];
function draw() {
const cubeP = connectedCubeArray[0];
const cubeQ = connectedCubeArray[1];
// Keep on chasing the othre Cube
const moveType = P5tCube.moveTypeId.withoutBack;
const spd = 80;
cubeP?.moveToCube( cubeQ, spd, moveType );
}
function mouseClicked() {
P5tCube.connectNewP5tCube().then( cube => {
connectedCubeArray.push( cube );
cube.turnLightOn( 'white' );
} );
}