xxxxxxxxxx
39
var canvas;
var h1;
var move = 100;
var bounce = 100;
var bgcolor;
var button;
function setup() {
canvas = createCanvas(600, 600);
//canvas.position(0,0);
h1 = createElement('h1', "this is a test");
bgcolor = color(178, 240, 255);
createP(''); //adds space
button = createButton("cronch");
button.mousePressed(changeColor);
bowl = loadImage("cereal.png");
spoon = loadImage("spoon.png");
}
function changeColor() {
bgcolor = color(random(255));
}
//function mousePressed() {
//h1.html("click on the bowl of cereal");
//createP("Hello! Welcome to The Cereal Bowl™");
//changeColor();
//}
function draw() {
background(bgcolor);
//178, 240, 255
//clear();
image(bowl, move, bounce, 200, 200);
h1.position(move, bounce);
move = move + random(-2, 2);
image(spoon, mouseX, mouseY, 100, 100);
}