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
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
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.