let house;
let ghost;
let tinted = false;
function preload() {
house = loadImage('Haunted House.jpg');
}
function setup() {
createCanvas(house.width, house.height);
ghost= loadImage('ghost.png');
tint(255, 30);
image(ghost,100,100);
}
function draw() {
background(house);
}
function mouseReleased() {
if (!tinted) {
tint(255, 0, 0);
background(house);
tinted = true;
} else {
noTint();
background(house);
tinted = false;
}
}
I want to make a haunted house sketch. The initial state is to show a picture of the house and hide the picture of the ghost.
What I tried to do: When I release the mouse, the house picture turns red tint and the ghost picture is displayed. When I release the mouse again, the house becomes without the tint effect and the ghost is hidden.
But it doesn’t work, no matter how I try.
I also want a text effect to appear when the ghost is displayed and to jiggle over time. But if I can’t even do the previous, this one is even less likely to work.