This content has been marked as final. Show 3 replies
does snds change value on each loop? if so, you can use it and an if-statement. if not, you'll need some variable that does change value on each loop or you'll need to start another loop (in your listener) that checks on the original loop.
snds does change value each loop it flip-flops between one of two sound files.
If someone presses the key during a loop that they are supposed to respond they get a happy beep, if they press the space bar during a loop they are not supposed to respond it plays a buzz sound.
So what you are saying is if I create an if statment (inside the keyListener) that says if the key has been pressed alreaady this loop than it should not play the sound. it should work?
Makes sense to me, now lets see if I can make it work.
alternating between two values won't work because someone make press once during a loop and then not press again next loop but then press the loop afterwards. so, snds will have changed (twice) but will back to its original value. you'll need to use another variable. a loop counter would be sufficient.