xxxxxxxxxx
20
// start from https://editor.p5js.org/Sofia_D/sketches/lTj_tvmjw
// see https://discourse.processing.org/t/moving-from-processing-with-java-to-p5-js/14912/5
// rewrite for PVector
let bubbles = [];
let many = 3;
function setup() {
createCanvas(800, 720);
for (let i = 0; i < many; i++) bubbles[i] = new Bubble(createVector(random(120, 600), random(120, 600), 0), random(10, 100));
}
function draw() {
background(200, 200, 0);
for (let i = 0; i < many; i++) {
for (let j = 0; j < many; j++)
if (j != i) bubbles[i].collide(bubbles[j]);
bubbles[i].draw();
}
}