i have a function that takes the position of the mouse and changes the sound that plays depending on where it is. However, it is weird because the function works fine if I move it from the bottom of my screen up but not the opposite way. So when I move the mouse downwards, there is nothing playing. I tried doing it the way it is below and also removing all the “.stop()” functions and I get the same result. I don’t know how to fix this so any help would be great!
if(position.y > 100 && position.y < 200){
sound1.play();
} else if(position.y > 201 && position.y < 300){
sound1.stop();
sound2.play();
}else if(position.y > 301 && position.y < 400){
sound1.stop();
sound2.stop();
sound3.play();
}else if(position.y > 401 && position.y < 500){
sound1.stop();
sound2.stop();
sound3.stop();
sound4.play();
}else if(position.y > 501 && position.y < 600){
sound1.stop();
sound2.stop();
sound3.stop();
sound4.stop();
sound5.play();
}else if (position.y > 601 && position.y < 700){
sound1.stop();
sound2.stop();
sound3.stop();
sound4.stop();
sound5.stop();
sound6.play();
}