i'm making a battleships game for a school assignment and i'm playing a sound when a boat is either hit or sunk. The sound plays fine but how do i make the program pause while the sound is playing?
thanks
Printable View
i'm making a battleships game for a school assignment and i'm playing a sound when a boat is either hit or sunk. The sound plays fine but how do i make the program pause while the sound is playing?
thanks
The details will all depend on how you are implementing your game including which graphics and GUI library you're using (AWT? Swing? AWT? Android?...?) and of course your game logic. Since you've asked a general question without the details, all I can give is a general answer: model your game in an MVC (model-view-control) fashion, and make the model unresponsive to user interaction via the control when sound is playing.
If you need more detailed help, consider telling us more of the necessary details about your program and your problem so that we can more fully understand the problem.