xxxxxxxxxx
60
let buttons = [];
let puzzleSolve;
let puzzleReveal;
let ding;
let spin;
let ehng;
let bankrupt;
let sounds = [];
function preload() {
soundFormats('mp3', 'ogg');
sounds[0] = loadSound('Sounds/solve.mp3');
sounds[1] = loadSound('Sounds/reveal.mp3');
sounds[2] = loadSound('Sounds/bankrupt.mp3');
sounds[3] = loadSound('Sounds/Ding.mp3');
sounds[4] = loadSound('Sounds/Buzzer.mp3');
sounds[5] = loadSound('Sounds/spin.mp3');
}
function setup() {
createCanvas(innerWidth, innerHeight);
puzzleReveal = createButton('reveal');
puzzleReveal.position(19, 19);
puzzleReveal.size(200,100);
puzzleReveal.style("font-size","26px");
puzzleReveal.mousePressed(function() { playSound(1);});
puzzleSolve = createButton('solved');
puzzleSolve.position(230, 19);
puzzleSolve.size(200,100);
puzzleSolve.style("font-size","26px");
puzzleSolve.mousePressed(function() { playSound(0);});
ding = createButton('ding');
ding.position(19, 130);
ding.size(200,100);
ding.style("font-size","26px");
ding.mousePressed(function() { playSound(3);});
ehng = createButton('buzzer');
ehng.position(230, 130);
ehng.size(200,100);
ehng.style("font-size","26px");
ehng.mousePressed(function() { playSound(4);});
spin = createButton('spin');
spin.position(19, 250);
spin.size(200,100);
spin.style("font-size","26px");
spin.mousePressed(function() { playSound(5);});
}
function draw() {
background(220);
}
function playSound(sound){
sounds[sound].play();
}