play sound when mouse pressed and paused when released

edited May 2016 in Library Questions

Hey guys, I'm trying to code a guitar hero like game for my school project. My goal is to have a guitar with different colors on the neck and depending on which color I press with the mouse a different note play. I'm not sure how to use a sound based on the X,Y position of the mouse and then have the sound play when the mouse is pressed and stop playing when the mouse is released. Any help would be appreciated!

Thanks

Tagged:

Answers

  • You could try:

    void mousePressed() {player.start();}
    
    void mouseReleased() {player.stop();}
    

    I hope this helps,

    Kf

Sign In or Register to comment.