diff --git a/bin/de/bricked/resources/sounds/g.mp3 b/bin/de/bricked/resources/sounds/g.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..8bf2fdc5a7439fa5d89cce76bd1c0a03eed8f5b9 Binary files /dev/null and b/bin/de/bricked/resources/sounds/g.mp3 differ diff --git a/bin/de/bricked/resources/sounds/s.mp3 b/bin/de/bricked/resources/sounds/s.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..e036fa38c4199c308e5f75241d9cf324202a72d3 Binary files /dev/null and b/bin/de/bricked/resources/sounds/s.mp3 differ diff --git a/bin/de/bricked/resources/sounds/unlocked.mp3 b/bin/de/bricked/resources/sounds/unlocked.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..fc3562c1d3c1a4cb3d58a2cffb2ff444197972d1 Binary files /dev/null and b/bin/de/bricked/resources/sounds/unlocked.mp3 differ diff --git a/src/de/bricked/game/sound/SoundHandler.java b/src/de/bricked/game/sound/SoundHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..886d9c55e20edfe06459a68cea6a19995739b908 --- /dev/null +++ b/src/de/bricked/game/sound/SoundHandler.java @@ -0,0 +1,27 @@ +package de.bricked.game.sound; + +import java.net.MalformedURLException; +import java.net.URISyntaxException; + +import javafx.scene.media.Media; +import javafx.scene.media.MediaPlayer; +import logger.LogLevel; +import logger.Logger; + +public class SoundHandler +{ + public static void play(String soundID) + { + try + { + String path = SoundHandler.class.getResource("/de/bricked/resources/sounds/" + soundID + ".mp3").toURI().toURL().toString(); + Media sound = new Media(path); + MediaPlayer mediaPlayer = new MediaPlayer(sound); + mediaPlayer.setAutoPlay(true); + } + catch(MalformedURLException | URISyntaxException e) + { + Logger.log(LogLevel.ERROR, Logger.exceptionToString(e)); + } + } +} \ No newline at end of file diff --git a/src/de/bricked/main/Main.java b/src/de/bricked/main/Main.java index cdc11817262f3dc5c0bdc3a44e5c97723f6a36be..b7f40ee44c4238525806cb59f641509865b938d9 100644 --- a/src/de/bricked/main/Main.java +++ b/src/de/bricked/main/Main.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Locale; import java.util.ResourceBundle; +import de.bricked.game.sound.SoundHandler; import de.bricked.ui.Controller; import javafx.application.Application; import javafx.event.EventHandler; @@ -66,8 +67,8 @@ public class Main extends Application else { Logger.setLevel(LogLevel.ERROR); - } - + } + launch(args); } } \ No newline at end of file diff --git a/src/de/bricked/resources/sounds/g.mp3 b/src/de/bricked/resources/sounds/g.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..8bf2fdc5a7439fa5d89cce76bd1c0a03eed8f5b9 Binary files /dev/null and b/src/de/bricked/resources/sounds/g.mp3 differ diff --git a/src/de/bricked/resources/sounds/s.mp3 b/src/de/bricked/resources/sounds/s.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..e036fa38c4199c308e5f75241d9cf324202a72d3 Binary files /dev/null and b/src/de/bricked/resources/sounds/s.mp3 differ diff --git a/src/de/bricked/resources/sounds/unlocked.mp3 b/src/de/bricked/resources/sounds/unlocked.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..fc3562c1d3c1a4cb3d58a2cffb2ff444197972d1 Binary files /dev/null and b/src/de/bricked/resources/sounds/unlocked.mp3 differ