We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So i'm makin' a snake game as a project, and fortunately i'm almost there. The last thing I need is to make a sound every time the snake eats one of the random squares, but as it is right now, it only plays the sound the first time. How can I fix this?
Another thing I don't know how to do is to make a restart button for the game over screen. How can I make a function that makes the game start all over again as if you closed the window and run the code over again?
Project file here, and make sure to have the minim audio extension installed!
Answers
you need to rewind() the sample
I cannot find any rewind() function in processing.org/reference
it's a method on a minim class so it's in their documentation, not the processing docs.
http://code.compartmental.net/minim/audioplayer_method_rewind.html
Just added the blop.rewind(); in the randomSquareCollision() function, and it works! Thank you!