# I don't know why the sound in my code isn't working.

This is my code. I don't know why the sound isn't working

keyPressed = function() {

background(151, 244, 247);

//these are the variables

var y = -200;

var x = 200;

var speed = 10;

//this draws the code inside of it over and over

draw = function() {

background(151, 244, 247);

fill(255, 0, 0);

ellipse(x, y, 70, 70);

fill(255, 200, 0);

ellipse(x - 15, y - 15, 10, 10);

ellipse(x + 15, y - 15, 10, 10);

line( x - 15, y + 15, x + 15, y + 15);

ellipse (x, y - 32, 70, 30);

fill ( 255, 200, 0);

ellipse ( x - 15, y + 30, 20, 20);

ellipse ( x - 0, y + 30, 20, 20);

ellipse ( x + 15, y + 30, 20, 20);

ellipse ( x + 10, y + 40, 20, 20);

ellipse ( x - 10, y + 40, 20, 20);

ellipse ( x + 2, y + 50, 20, 20);

//this makes is move

if(y > 350) {

speed = -10;

playSound(getSound ("rpg/hit-thud"));

}

if ( y < 50) {

speed = 10;

playSound(getSound ("rpg/hit-thud"));

}

y = y + speed;

if(x > 350) {

speed = -10;

playSound(getSound ("rpg/hit-thud"));

}

if ( x < 50) {

speed = 10;

playSound(getSound ("rpg/hit-thud"));

}

x = x + speed;

};

};

Please sign in to leave a comment.