Added 3 more sounds. Added function calls to test sounds, some still untested
This commit is contained in:
parent
f5a0f8c9fe
commit
626ae041e5
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -102,6 +102,7 @@ public class BoardDisplay extends JPanel {
|
|||
} else if (SwingUtilities.isLeftMouseButton(e)) {
|
||||
Point o = new Point(x, y);
|
||||
handleFieldClick(o);
|
||||
SoundHandler.playSound("plop");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -222,13 +223,16 @@ public class BoardDisplay extends JPanel {
|
|||
switch (hit.getType()) {
|
||||
case HIT:
|
||||
fields[i][j].setBackground(Color.ORANGE);
|
||||
SoundHandler.playSound("hit");
|
||||
break;
|
||||
case SUNK:
|
||||
case VICTORY:
|
||||
SoundHandler.playSound("destroyed");
|
||||
fields[i][j].setBackground(Color.RED);
|
||||
break;
|
||||
case MISS:
|
||||
if (this.enemyBoard) {
|
||||
SoundHandler.playSound("miss");
|
||||
fields[i][j].setBackground(Color.BLUE);
|
||||
} else {
|
||||
fields[i][j].setBackground(Color.CYAN);
|
||||
|
|
|
@ -7,8 +7,8 @@ public class HalloSchiffeVersenken {
|
|||
System.out.println("HelloSchiffeVersenekn");
|
||||
|
||||
|
||||
System.out.println("sound");
|
||||
SoundHandler.playSound("hit");
|
||||
//System.out.println("sound");
|
||||
//SoundHandler.playSound("hit");
|
||||
|
||||
Thread.sleep(10000);
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@ import java.net.InetSocketAddress;
|
|||
/**
|
||||
* Das JoinGame Panel dient zum setzten des Ports/IP-Adresse.
|
||||
* Anschließend kann das Verbinden Panel gezeigt werden.
|
||||
* 51525
|
||||
* ssh.lgc.sh
|
||||
*/
|
||||
public class JoinGame extends JPanel {
|
||||
// Grafiken
|
||||
|
|
|
@ -16,7 +16,10 @@ public class SoundHandler {
|
|||
|
||||
// Wenn fehler beim erstellen von .jar mit sound hier gucken
|
||||
private static HashMap<String, String> sounds = new HashMap<String, String>(Map.of(
|
||||
"hit", "./Sound/water-drip.mp3"
|
||||
"miss", "./Sound/water-drip.mp3",
|
||||
"hit", "./Sound/hit.mp3",
|
||||
"destroyed", "./Sound/hit.mp3",
|
||||
"plop", "./Sound/plop.mp3"
|
||||
));
|
||||
|
||||
public static void playSound(String soundName) {
|
||||
|
|
Loading…
Reference in New Issue