let cat;
let dog;
let b = false;
let bx = 0;
let by = 0;
let c = true;
let d;
let cnt = 0;
let bkw = false;
function preload() {
cat = loadImage("/assets/Pawcat.png");
dog = loadImage("/assets/Pawdog.png");
}
function setup() {
h = min(windowHeight, 700);
createCanvas(windowWidth, h);
background(0);
fill(200, 0, 0);
rectMode(CENTER);
d = 0;
}
function draw() {
background(0);
if (b) {
circle(bx, by, 10);
if (d === 0) {
if (c) {
image(cat, bx - 520, height - cnt, 800, 800);
}
if (!c) {
image(dog, bx - 520, height - cnt, 800, 800);
}
if (height - cnt > by - 130 && !bkw) {
cnt = cnt + 20;
}
if (height - cnt <= by - 130) {
bkw = true;
fill(0);
}
if (bkw && height - cnt < height) {
cnt = cnt - 10;
}
if (bkw && height - cnt >= height) {
b = !b;
cnt = 0;
c = !c;
bkw = !bkw;
fill(200, 0, 0);
}
}
}
}
function mousePressed() {
if (!b) {
b = true;
bx = mouseX;
by = mouseY;
}
}