xxxxxxxxxx
var v= 0;
var click = false;
var r = 255;
var g = 255;
var b = 255;
function preload(){
sounda = loadSound ("a.mp3");
soundb = loadSound ("b.mp3");
soundc = loadSound ("c.mp3");
soundd = loadSound ("d.mp3");
sounde = loadSound ("e.mp3");
img01 = loadImage("1.png");
img02 = loadImage("2.png");
img03 = loadImage("3.png");
img04 = loadImage("4.png");
img05 = loadImage("5.png");
img06 = loadImage("6.png");
img07 = loadImage("7.png");
img08 = loadImage("8.png");
img09 = loadImage("9.png");
img10 = loadImage("10.png");
img11 = loadImage("11.png");
img12 = loadImage("12.png");
img13 = loadImage("13.png");
img14 = loadImage("14.png");
img15 = loadImage("15.png");
imgcount = [img01,img02,img03,img04,img05,img06,img07,img08,img09,img10,img11,img11,img12,img13,img14,img15];
soundcounts = [sounda,soundb,soundc,soundc,soundc,soundd,soundc,sounde];
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(r,g,b)
n = int(random(0,15))
}
function draw() {
fill(255,255,255);
rect(0,0,width,height);
background(r,g,b);
fill(0);
text("Click to play a sound!",width/2-55, 100);
text("Press keys to change color.",width/2-60, 120);
if (click == true){
image(imgcount[n],width/3,80);
}
}
function mouseClicked(){
n = int(random(0,15));
var soundcounts = [sounda,soundb,soundc,soundc,soundc,soundc,soundd,soundc,sounde];
/*abc ccdce*/
click = true;
if(v <9){
v=v+1;}
else{v=1;}
if (click == true&&v>0){
soundcounts[v-1].play();
}
}
function keyPressed(){
if (key === 'q'){
r = 255;
g = 255;
b = 0;}
else if (key === 'a'){
r = 0;
g = 255;
b = 255;}
else if (key === 'z'){
r = 255;
g = 0;
b = 255;}
else if (key === 'w'){
r = 0;
g = 0;
b = 255;}
else if (key === 's'){
r = 255;
g = 0;
b = 0;}
else if (key === 'x'){
r = 0;
g = 255;
b = 0;}
else if (key === 'e'){
r = 255;
g = 0;
b = 120;}
else if (key === 'd'){
r = 120;
g = 0;
b = 255;}
else if (key === 'c'){
r = 255;
g = 120;
b = 0;}
else if (key === 'r'){
r = 0;
g = 255;
b = 120;}
else if (key === 'f'){
r = 0;
g = 120;
b = 255;}
else if (key === 'v'){
r = 120;
g = 120;
b = 120;}
else if (key === ' '){
r = random(0,255);
g = random(0,255);
b = random(0,255);}
else{
r = 255;
g = 255;
b = 255;}
}