xxxxxxxxxx
48
/*
* https://findtheinvisiblecow.com/
*
* A clone of a popular game for first time coders
* (c) 2018 - Andrew Grosser - https://twitter.com/andrewgrosser
*/
//Share global variables
var moo;
var cow;
var wahoo;
var x_width = 400;
var y_height = 400;
var found = false;
//Do this before anything
function preload() {
//soundbible.com
moo = loadSound('https://s3.amazonaws.com/findthe/cow.mp3');
wahoo = loadSound('https://s3.amazonaws.com/findthe/wahoo.mp3');
//wikipedia
cow = loadImage('https://s3.amazonaws.com/findthe/cow.svg');
}
//Run p5js setup
function setup() {
moo.setVolume(0.1);
moo.loop();
createCanvas(x_width, y_height);
}
//Here we draw/run our infinite loop
function draw() {
if (found == false) {
background(220);
if (mouseX > 250 && mouseX < 270 && mouseY > 250 && mouseY <270) {
tint(255,255,255,255)
moo.stop();
wahoo.play();
found = true;
}
else {
tint(255,255,255,0)
moo.setVolume(0.5)
}
image(cow, 250, 250, 20, 20);
}
}