xxxxxxxxxx
32
// Connie Hu - Final Sketch
function preload() {
frog = loadImage("DopeyFrog.png");
}
function setup(){
createCanvas(500, 500);
x = random(100, 300);
y = random(100, 300);
xspeed = 4;
yspeed = 4;
}
function draw() {
background(105, 125, 255);
image(frog, x, y, 100 ,100);
x = x + xspeed;
y = y + yspeed;
if (x + 107 >= width || x <= 0) {
xspeed = xspeed * -1;
//background(random(255));
}
if (y + 120 >= height || y <= 0) {
yspeed = yspeed * -1;
//background(random(255));
}
}