xxxxxxxxxx
38
let drums = [];
function preload() {
for (let d = 0; d<7; d++) {
let drim = loadSound ("drums/")
}
}
function setup() {
createCanvas(windowWidth,windowHeight);
}
let BEAT = 60
function draw() {
background(220);
x++;
if(x>width) {
x=0;
background('white');
}
let y =0;
fill('black')
if (framCount % BEAT == 1) {
drums[0].play();
rect(x,y,5,15)
}
// Mango
if (framCount % (BEAT/2) == 1) {
drums[1].play();
rect(x,y,5,15)
// Pineapple
y+ =height/drums
if (framCount % (BEAT/3) == 1) {
drums[2].play();
rect(x,y,5,15)
}
function keyPressed() {
drum [key-1].play();
}