We are about to switch to a new forum software. Until then we have removed the registration on this forum.
var a=0; var song; function setup() { song = loadSound('assets/lucky_dragons_-_power_melody.mp3'); createCanvas(600,600); background(0); frameRate(70);
}
function mousePressed() {
if ( song.isPlaying() ) { // .isPlaying() returns a boolean
song.stop();
background(0,0,0);
} else {
song.play();
background(0,0,0);
}
function draw() {
strokeWeight(6);
var l=random(400);
stroke(0);
fill (400)
line (a,1,a,0);
stroke(800);
line(a,1,a,l);
a=a+5;
if (a>600){
a=0;
}
if ( song.isPlaying() ) { song.stop(); background(0,0,0); } else { song.play(); background(0,0,0); } }
Im trying to put my image together with the song to click on but it's not working as much as expected.....
Answers
Edit post, select your code and hit ctrl+o to format your code. Make sure there is an empty line above and below your code.
Also tell us more about your expectations. What is happening and what should be happening.
Kf