xxxxxxxxxx
69
//loading images
let img, bkg;
function preload() {
img = loadImage("images/banana.png");
bkg = loadImage("images/sand.jpg");
}
function drawImages() {
imageMode(CORNER);
background(bkg);
imageMode(CENTER);
image(img, 200, 200, 100, 68);
}
let bubble1;
let bubble2 = {
x:200, y: 200
}
function drawBubble(ob) {
noFill();
stroke(255);
strokeWeight(5);
ellipse(ob.x, ob.y, 80);
}
function moveBubble(ob) {
ob.x += random(-2, 2);
ob.y += random(-2, 2);
}
function drawBubbles() {
background(20);
//drawBubble(bubble1);
//moveBubble(bubble1);
//drawBubble(bubble2);
//moveBubble(bubble2);
bubble1.show();
bubble1.move();
}
class Bubble {
constructor(x, y) {
this.x = x;
this.y = y;
}
show() {
}
}
function setup() {
createCanvas(400, 400);
bubble1 = new Bubble(200, 200);
}
function draw() {
//drawImages();
drawBubbles();
}