diff --git a/bin/de/bricked/resources/sounds/destroy_brick.mp3 b/bin/de/bricked/resources/sounds/destroy_brick.mp3 deleted file mode 100644 index 188f9704a00f3421a37a438580cd8c0c7af71903..0000000000000000000000000000000000000000 Binary files a/bin/de/bricked/resources/sounds/destroy_brick.mp3 and /dev/null differ diff --git a/bin/de/bricked/resources/sounds/destroy_brick.wav b/bin/de/bricked/resources/sounds/destroy_brick.wav new file mode 100644 index 0000000000000000000000000000000000000000..59cc7da0dc99466bce481c2fceca90b1af20bdb6 Binary files /dev/null and b/bin/de/bricked/resources/sounds/destroy_brick.wav differ diff --git a/bin/de/bricked/resources/sounds/finished_level.mp3 b/bin/de/bricked/resources/sounds/finished_level.mp3 deleted file mode 100644 index 7b190396ae0060beca3709f697a1c4f8cb7c1003..0000000000000000000000000000000000000000 Binary files a/bin/de/bricked/resources/sounds/finished_level.mp3 and /dev/null differ diff --git a/bin/de/bricked/resources/sounds/finished_level.wav b/bin/de/bricked/resources/sounds/finished_level.wav new file mode 100644 index 0000000000000000000000000000000000000000..4a5fa028b6e2da883faca1e6c2e07e93d4656375 Binary files /dev/null and b/bin/de/bricked/resources/sounds/finished_level.wav differ diff --git a/bin/de/bricked/resources/sounds/game_over.mp3 b/bin/de/bricked/resources/sounds/game_over.mp3 deleted file mode 100644 index 80148d9cdd4ee2bb79d38b46b8f2e332682a2dbd..0000000000000000000000000000000000000000 Binary files a/bin/de/bricked/resources/sounds/game_over.mp3 and /dev/null differ diff --git a/bin/de/bricked/resources/sounds/game_over.wav b/bin/de/bricked/resources/sounds/game_over.wav new file mode 100644 index 0000000000000000000000000000000000000000..4b5007c5812fc41a28b6467509fffdcc5786a02c Binary files /dev/null and b/bin/de/bricked/resources/sounds/game_over.wav differ diff --git a/bin/de/bricked/resources/sounds/hit_brick.mp3 b/bin/de/bricked/resources/sounds/hit_brick.mp3 deleted file mode 100644 index 80dae7bf515d60865328b6fd9e6e59ddd97fb25f..0000000000000000000000000000000000000000 Binary files a/bin/de/bricked/resources/sounds/hit_brick.mp3 and /dev/null differ diff --git a/bin/de/bricked/resources/sounds/hit_brick.wav b/bin/de/bricked/resources/sounds/hit_brick.wav new file mode 100644 index 0000000000000000000000000000000000000000..b0fc1d251bdf03a8007bdb8784a2bdfe4f85f72e Binary files /dev/null and b/bin/de/bricked/resources/sounds/hit_brick.wav differ diff --git a/bin/de/bricked/resources/sounds/hit_paddle.mp3 b/bin/de/bricked/resources/sounds/hit_paddle.mp3 deleted file mode 100644 index d57dd2687c1d7614940b655e80a357add37c0107..0000000000000000000000000000000000000000 Binary files a/bin/de/bricked/resources/sounds/hit_paddle.mp3 and /dev/null differ diff --git a/bin/de/bricked/resources/sounds/hit_paddle.wav b/bin/de/bricked/resources/sounds/hit_paddle.wav new file mode 100644 index 0000000000000000000000000000000000000000..a1b047deaf395c676b398d22a64aaa1122dfc58f Binary files /dev/null and b/bin/de/bricked/resources/sounds/hit_paddle.wav differ diff --git a/bin/de/bricked/resources/sounds/hit_wall.mp3 b/bin/de/bricked/resources/sounds/hit_wall.mp3 deleted file mode 100644 index b3944f7afdc3a2186323014077e1bf74b2190b3d..0000000000000000000000000000000000000000 Binary files a/bin/de/bricked/resources/sounds/hit_wall.mp3 and /dev/null differ diff --git a/bin/de/bricked/resources/sounds/hit_wall.wav b/bin/de/bricked/resources/sounds/hit_wall.wav new file mode 100644 index 0000000000000000000000000000000000000000..b040a4191e67f2a03344493c6b3923f85d0f2cbd Binary files /dev/null and b/bin/de/bricked/resources/sounds/hit_wall.wav differ diff --git a/bin/de/bricked/resources/sounds/life_lost.mp3 b/bin/de/bricked/resources/sounds/life_lost.mp3 deleted file mode 100644 index 9ae1796065f2db2cf15377e42aacd97cfd590350..0000000000000000000000000000000000000000 Binary files a/bin/de/bricked/resources/sounds/life_lost.mp3 and /dev/null differ diff --git a/bin/de/bricked/resources/sounds/life_lost.wav b/bin/de/bricked/resources/sounds/life_lost.wav new file mode 100644 index 0000000000000000000000000000000000000000..dabc3615f1f22429e487d397dab39d98d73bd034 Binary files /dev/null and b/bin/de/bricked/resources/sounds/life_lost.wav differ diff --git a/bin/de/bricked/resources/sounds/tnt.mp3 b/bin/de/bricked/resources/sounds/tnt.mp3 deleted file mode 100644 index 308c229c4fb80b2cceb8d98b78fe03ab06f35fba..0000000000000000000000000000000000000000 Binary files a/bin/de/bricked/resources/sounds/tnt.mp3 and /dev/null differ diff --git a/bin/de/bricked/resources/sounds/tnt.wav b/bin/de/bricked/resources/sounds/tnt.wav new file mode 100644 index 0000000000000000000000000000000000000000..581b5f56fe2a20303119d1292140c9c383410a21 Binary files /dev/null and b/bin/de/bricked/resources/sounds/tnt.wav differ diff --git a/bin/de/bricked/resources/sounds/unlocked.mp3 b/bin/de/bricked/resources/sounds/unlocked.mp3 deleted file mode 100644 index fc3562c1d3c1a4cb3d58a2cffb2ff444197972d1..0000000000000000000000000000000000000000 Binary files a/bin/de/bricked/resources/sounds/unlocked.mp3 and /dev/null differ diff --git a/bin/de/bricked/resources/sounds/unlocked.wav b/bin/de/bricked/resources/sounds/unlocked.wav new file mode 100644 index 0000000000000000000000000000000000000000..065a5ea5d8a3e3702d95c654d5fa5ddcbc0d6a83 Binary files /dev/null and b/bin/de/bricked/resources/sounds/unlocked.wav differ diff --git a/lib/TinySound.jar b/lib/TinySound.jar new file mode 100644 index 0000000000000000000000000000000000000000..64ca033f246d9f2ff8a1581eb5108527ddd8c82a Binary files /dev/null and b/lib/TinySound.jar differ diff --git a/lib/jorbis-0.0.17.jar b/lib/jorbis-0.0.17.jar new file mode 100644 index 0000000000000000000000000000000000000000..d3de17562e25380623c34e6d14b9b92177617cc0 Binary files /dev/null and b/lib/jorbis-0.0.17.jar differ diff --git a/lib/tritonus_share.jar b/lib/tritonus_share.jar new file mode 100644 index 0000000000000000000000000000000000000000..d21ba89ad75ad7ce561c1d21c42034ae5c677d6b Binary files /dev/null and b/lib/tritonus_share.jar differ diff --git a/lib/vorbisspi1.0.3.jar b/lib/vorbisspi1.0.3.jar new file mode 100644 index 0000000000000000000000000000000000000000..cd65017665e93baaac718888dfb407ff090fbea6 Binary files /dev/null and b/lib/vorbisspi1.0.3.jar differ diff --git a/src/de/bricked/game/Game.java b/src/de/bricked/game/Game.java index dc3a8ed8bdc2887d38d84a85a1f188221c770e4d..649c06251fd8178cf7ba6daa4f767489a4183d52 100644 --- a/src/de/bricked/game/Game.java +++ b/src/de/bricked/game/Game.java @@ -36,10 +36,8 @@ public class Game public Game() { this.settings = new Settings(); - this.soundHandler = new SoundHandler(); - //DEBUG - soundHandler.setVolume(1.0); - soundHandler.setMuted(false); + //DEBUG values in constructor should be loaded from settings + this.soundHandler = new SoundHandler(1.0, false); this.levelPack = null; this.level = null; this.livesRemaining = 0; diff --git a/src/de/bricked/game/board/Board.java b/src/de/bricked/game/board/Board.java index 7e8b3afa18024a4de810b96ecf1862bb8b699ff4..e684131b7a0c3ac32e02f05086718e38112cc6f1 100644 --- a/src/de/bricked/game/board/Board.java +++ b/src/de/bricked/game/board/Board.java @@ -10,6 +10,7 @@ import de.bricked.game.powerups.ExtraLifePowerUp; import de.bricked.game.powerups.PowerUp; import de.bricked.game.powerups.ball.ExplodeBallPowerUp; import de.bricked.game.powerups.ball.NoCollisionBallPowerUp; +import de.bricked.game.sound.SoundType; import de.bricked.ui.LevelController; public class Board @@ -178,22 +179,22 @@ public class Board } bricks.get(row).set(col, new Brick(BrickType.TNT)); - destroyBrick(row, col, false); + destroyBrick(row, col, false, false); break; case NO_COLLISION: - destroyBrick(row, col, true); + destroyBrick(row, col, true, true); break; default: - destroyBrick(row, col, false); + destroyBrick(row, col, false, true); break; } return points; } - public void destroyBrick(int row, int col, boolean instantDestroy) + public void destroyBrick(int row, int col, boolean instantDestroy, boolean playDestroySound) { Brick hittedBrick = bricks.get(row).get(col); @@ -210,11 +211,14 @@ public class Board if(hittedBrick.getType().equals(BrickType.TNT)) { explodeBrick(row, col); - game.getSoundHandler().play("tnt"); + game.getSoundHandler().play(SoundType.TNT); } else { - game.getSoundHandler().play("destroy_brick"); + if(playDestroySound) + { + game.getSoundHandler().play(SoundType.DESTROY_BRICK); + } } if(hittedBrick.getPowerUp() != null) @@ -234,7 +238,7 @@ public class Board } else { - game.getSoundHandler().play("hit_brick"); + game.getSoundHandler().play(SoundType.HIT_BRICK); LevelController.redrawBrick(col, row, bricks.get(row).get(col), false); } } @@ -252,7 +256,7 @@ public class Board { if(k >= 0 && k < WIDTH) { - destroyBrick(i, k, true); + destroyBrick(i, k, true, true); } } } diff --git a/src/de/bricked/game/sound/SoundHandler.java b/src/de/bricked/game/sound/SoundHandler.java index e72c1e8dffcb6d7f3e0f920f41e7b37be0105549..34419b33f5468dcacfdfb70e750be64ad73398b4 100644 --- a/src/de/bricked/game/sound/SoundHandler.java +++ b/src/de/bricked/game/sound/SoundHandler.java @@ -2,72 +2,97 @@ package de.bricked.game.sound; import java.net.MalformedURLException; import java.net.URISyntaxException; +import java.net.URL; +import java.util.HashMap; import de.bricked.game.Config; -import javafx.scene.media.Media; -import javafx.scene.media.MediaPlayer; +import kuusisto.tinysound.Sound; +import kuusisto.tinysound.TinySound; import logger.LogLevel; import logger.Logger; public class SoundHandler { - private double volume; - private boolean muted; - private boolean isPlayingTNT; - - public SoundHandler() - { - volume = 0.0; - muted = false; - isPlayingTNT = false; - } - - public void play(String soundID) + private double volume; + private boolean muted; + private HashMap<SoundType, Sound> mediaPlayers; + private int tntCounter; + + static { - if(volume > 0 && !muted) - { - try - { - if(!isPlayingTNT) - { - if(soundID.equalsIgnoreCase("tnt")) - { - isPlayingTNT = true; - } - String path = SoundHandler.class.getResource(Config.JAR_SOUND_SAVEDIR + soundID + ".mp3").toURI().toURL().toString(); - Media sound = new Media(path); - MediaPlayer mediaPlayer = new MediaPlayer(sound); - mediaPlayer.setVolume(volume); - mediaPlayer.setAutoPlay(true); - mediaPlayer.setOnEndOfMedia(()->{ - isPlayingTNT = false; - }); - } - } - catch (MalformedURLException | URISyntaxException e) - { - Logger.log(LogLevel.ERROR, Logger.exceptionToString(e)); - } - } + TinySound.init(); + } + + public SoundHandler(double volume, boolean muted) + { + this.volume = volume; + this.muted = muted; + this.tntCounter = 0; + + mediaPlayers = new HashMap<>(); + + for(SoundType currentType : SoundType.values()) + { + try + { + URL path = SoundHandler.class.getResource(Config.JAR_SOUND_SAVEDIR + currentType.getFileName() + ".wav").toURI().toURL(); + + Sound sound = TinySound.loadSound(path); + mediaPlayers.put(currentType, sound); + } + catch(MalformedURLException | URISyntaxException e) + { + Logger.log(LogLevel.ERROR, Logger.exceptionToString(e)); + } + } } - public double getVolume() - { - return volume; - } + public void play(SoundType soundType) + { + if(volume > 0 && !muted) + { + Sound player = mediaPlayers.get(soundType); + if(soundType.equals(SoundType.TNT)) + { + tntCounter++; + } + else + { + tntCounter = 0; + } + + if(player != null && tntCounter < 2) + { + player.play(volume); + } + } + } - public boolean isMuted() - { - return muted; - } + public double getVolume() + { + return volume; + } - public void setVolume(double volume) - { - this.volume = volume; - } + public boolean isMuted() + { + return muted; + } - public void setMuted(boolean muted) - { - this.muted = muted; - } + public void setVolume(double volume) + { + this.volume = volume; + } + + public void setMuted(boolean muted) + { + this.muted = muted; + } + + public void stopAll() + { + for(Sound currentSound : mediaPlayers.values()) + { + currentSound.stop(); + } + } } \ No newline at end of file diff --git a/src/de/bricked/game/sound/SoundType.java b/src/de/bricked/game/sound/SoundType.java new file mode 100644 index 0000000000000000000000000000000000000000..191d459747e628d8af9c7dbe62c87760e01f4762 --- /dev/null +++ b/src/de/bricked/game/sound/SoundType.java @@ -0,0 +1,26 @@ +package de.bricked.game.sound; + +public enum SoundType +{ + HIT_WALL("hit_wall"), + HIT_PADDLE("hit_paddle"), + HIT_BRICK("hit_brick"), + DESTROY_BRICK("destroy_brick"), + TNT("tnt"), + LIFE_LOST("life_lost"), + GAME_OVER("game_over"), + FINISHED_LEVEL("finished_level"), + UNLOCKED("unlocked"); + + private String fileName; + + private SoundType(String fileName) + { + this.fileName = fileName; + } + + public String getFileName() + { + return fileName; + } +} \ No newline at end of file diff --git a/src/de/bricked/resources/sounds/destroy_brick.mp3 b/src/de/bricked/resources/sounds/destroy_brick.mp3 deleted file mode 100644 index 188f9704a00f3421a37a438580cd8c0c7af71903..0000000000000000000000000000000000000000 Binary files a/src/de/bricked/resources/sounds/destroy_brick.mp3 and /dev/null differ diff --git a/src/de/bricked/resources/sounds/destroy_brick.wav b/src/de/bricked/resources/sounds/destroy_brick.wav new file mode 100644 index 0000000000000000000000000000000000000000..59cc7da0dc99466bce481c2fceca90b1af20bdb6 Binary files /dev/null and b/src/de/bricked/resources/sounds/destroy_brick.wav differ diff --git a/src/de/bricked/resources/sounds/finished_level.mp3 b/src/de/bricked/resources/sounds/finished_level.mp3 deleted file mode 100644 index 7b190396ae0060beca3709f697a1c4f8cb7c1003..0000000000000000000000000000000000000000 Binary files a/src/de/bricked/resources/sounds/finished_level.mp3 and /dev/null differ diff --git a/src/de/bricked/resources/sounds/finished_level.wav b/src/de/bricked/resources/sounds/finished_level.wav new file mode 100644 index 0000000000000000000000000000000000000000..4a5fa028b6e2da883faca1e6c2e07e93d4656375 Binary files /dev/null and b/src/de/bricked/resources/sounds/finished_level.wav differ diff --git a/src/de/bricked/resources/sounds/game_over.mp3 b/src/de/bricked/resources/sounds/game_over.mp3 deleted file mode 100644 index 80148d9cdd4ee2bb79d38b46b8f2e332682a2dbd..0000000000000000000000000000000000000000 Binary files a/src/de/bricked/resources/sounds/game_over.mp3 and /dev/null differ diff --git a/src/de/bricked/resources/sounds/game_over.wav b/src/de/bricked/resources/sounds/game_over.wav new file mode 100644 index 0000000000000000000000000000000000000000..4b5007c5812fc41a28b6467509fffdcc5786a02c Binary files /dev/null and b/src/de/bricked/resources/sounds/game_over.wav differ diff --git a/src/de/bricked/resources/sounds/hit_brick.mp3 b/src/de/bricked/resources/sounds/hit_brick.mp3 deleted file mode 100644 index 80dae7bf515d60865328b6fd9e6e59ddd97fb25f..0000000000000000000000000000000000000000 Binary files a/src/de/bricked/resources/sounds/hit_brick.mp3 and /dev/null differ diff --git a/src/de/bricked/resources/sounds/hit_brick.wav b/src/de/bricked/resources/sounds/hit_brick.wav new file mode 100644 index 0000000000000000000000000000000000000000..b0fc1d251bdf03a8007bdb8784a2bdfe4f85f72e Binary files /dev/null and b/src/de/bricked/resources/sounds/hit_brick.wav differ diff --git a/src/de/bricked/resources/sounds/hit_paddle.mp3 b/src/de/bricked/resources/sounds/hit_paddle.mp3 deleted file mode 100644 index d57dd2687c1d7614940b655e80a357add37c0107..0000000000000000000000000000000000000000 Binary files a/src/de/bricked/resources/sounds/hit_paddle.mp3 and /dev/null differ diff --git a/src/de/bricked/resources/sounds/hit_paddle.wav b/src/de/bricked/resources/sounds/hit_paddle.wav new file mode 100644 index 0000000000000000000000000000000000000000..a1b047deaf395c676b398d22a64aaa1122dfc58f Binary files /dev/null and b/src/de/bricked/resources/sounds/hit_paddle.wav differ diff --git a/src/de/bricked/resources/sounds/hit_wall.mp3 b/src/de/bricked/resources/sounds/hit_wall.mp3 deleted file mode 100644 index b3944f7afdc3a2186323014077e1bf74b2190b3d..0000000000000000000000000000000000000000 Binary files a/src/de/bricked/resources/sounds/hit_wall.mp3 and /dev/null differ diff --git a/src/de/bricked/resources/sounds/hit_wall.wav b/src/de/bricked/resources/sounds/hit_wall.wav new file mode 100644 index 0000000000000000000000000000000000000000..b040a4191e67f2a03344493c6b3923f85d0f2cbd Binary files /dev/null and b/src/de/bricked/resources/sounds/hit_wall.wav differ diff --git a/src/de/bricked/resources/sounds/life_lost.mp3 b/src/de/bricked/resources/sounds/life_lost.mp3 deleted file mode 100644 index 9ae1796065f2db2cf15377e42aacd97cfd590350..0000000000000000000000000000000000000000 Binary files a/src/de/bricked/resources/sounds/life_lost.mp3 and /dev/null differ diff --git a/src/de/bricked/resources/sounds/life_lost.wav b/src/de/bricked/resources/sounds/life_lost.wav new file mode 100644 index 0000000000000000000000000000000000000000..dabc3615f1f22429e487d397dab39d98d73bd034 Binary files /dev/null and b/src/de/bricked/resources/sounds/life_lost.wav differ diff --git a/src/de/bricked/resources/sounds/tnt.mp3 b/src/de/bricked/resources/sounds/tnt.mp3 deleted file mode 100644 index 308c229c4fb80b2cceb8d98b78fe03ab06f35fba..0000000000000000000000000000000000000000 Binary files a/src/de/bricked/resources/sounds/tnt.mp3 and /dev/null differ diff --git a/src/de/bricked/resources/sounds/tnt.wav b/src/de/bricked/resources/sounds/tnt.wav new file mode 100644 index 0000000000000000000000000000000000000000..581b5f56fe2a20303119d1292140c9c383410a21 Binary files /dev/null and b/src/de/bricked/resources/sounds/tnt.wav differ diff --git a/src/de/bricked/resources/sounds/unlocked.mp3 b/src/de/bricked/resources/sounds/unlocked.mp3 deleted file mode 100644 index fc3562c1d3c1a4cb3d58a2cffb2ff444197972d1..0000000000000000000000000000000000000000 Binary files a/src/de/bricked/resources/sounds/unlocked.mp3 and /dev/null differ diff --git a/src/de/bricked/resources/sounds/unlocked.wav b/src/de/bricked/resources/sounds/unlocked.wav new file mode 100644 index 0000000000000000000000000000000000000000..065a5ea5d8a3e3702d95c654d5fa5ddcbc0d6a83 Binary files /dev/null and b/src/de/bricked/resources/sounds/unlocked.wav differ diff --git a/src/de/bricked/ui/Controller.java b/src/de/bricked/ui/Controller.java index 5e578dba8eb5349c3a41fbc0fe3f2eb7453e4857..71e276a999eeb91f00867fea931463f07be8fb79 100644 --- a/src/de/bricked/ui/Controller.java +++ b/src/de/bricked/ui/Controller.java @@ -7,6 +7,7 @@ import java.util.ResourceBundle; import de.bricked.commandLine.CommandLine; import de.bricked.commandLine.commands.CommandBundle; import de.bricked.game.Game; +import javafx.application.Platform; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; @@ -20,6 +21,8 @@ import javafx.scene.input.KeyEvent; import javafx.scene.layout.AnchorPane; import javafx.stage.Modality; import javafx.stage.Stage; +import javafx.stage.WindowEvent; +import kuusisto.tinysound.TinySound; import logger.LogLevel; import logger.Logger; @@ -58,6 +61,17 @@ public class Controller } }); + stage.setOnCloseRequest(new EventHandler<WindowEvent>() + { + @Override + public void handle(WindowEvent event) + { + TinySound.shutdown(); + Platform.exit(); + System.exit(0); + } + }); + mainPane.setStyle("-fx-base: " + bundle.getString("color.background") + ";"); buttonLevelSelect.setStyle("-fx-base: " + bundle.getString("color.button")); buttonSettings.setStyle("-fx-base: " + bundle.getString("color.button")); diff --git a/src/de/bricked/ui/LevelController.java b/src/de/bricked/ui/LevelController.java index 185cf18ff8ddfd39921ab8832a6738a968f5245b..22b92950a92d939525cb3dcca6f26eea96459e2d 100644 --- a/src/de/bricked/ui/LevelController.java +++ b/src/de/bricked/ui/LevelController.java @@ -19,6 +19,7 @@ import de.bricked.game.paddle.Paddle; import de.bricked.game.paddle.PaddleSize; import de.bricked.game.powerups.PowerUp; import de.bricked.game.powerups.PowerUpType; +import de.bricked.game.sound.SoundType; import de.bricked.utils.CountdownTimer; import fontAwesome.FontIcon; import fontAwesome.FontIconType; @@ -62,6 +63,7 @@ import javafx.scene.text.Text; import javafx.stage.Stage; import javafx.stage.WindowEvent; import javafx.util.Duration; +import kuusisto.tinysound.TinySound; import logger.LogLevel; import logger.Logger; import tools.Worker; @@ -286,6 +288,8 @@ public class LevelController { timer.stop(); } + + TinySound.shutdown(); Worker.shutdown(); Platform.exit(); System.exit(0); @@ -441,7 +445,7 @@ public class LevelController gameState = GameState.STOPPED; timer.stop(); - game.getSoundHandler().play("game_over"); + game.getSoundHandler().play(SoundType.GAME_OVER); Platform.runLater(() -> { Alert alert = new Alert(AlertType.INFORMATION); @@ -460,7 +464,7 @@ public class LevelController gameState = GameState.WAITING; timer.stop(); - game.getSoundHandler().play("life_lost"); + game.getSoundHandler().play(SoundType.LIFE_LOST); // reset paddle and ball initPaddle(game.getLevel().getInitPadSize()); @@ -472,7 +476,7 @@ public class LevelController { game.getBall().setDirection(game.reflectBall(hitLocation, game.getBall().getDirection())); - game.getSoundHandler().play("hit_wall"); + game.getSoundHandler().play(SoundType.HIT_WALL); switch(hitLocation) { @@ -524,7 +528,7 @@ public class LevelController resetMultiplicator(); - game.getSoundHandler().play("hit_paddle"); + game.getSoundHandler().play(SoundType.HIT_PADDLE); } // ball doesn't collide with paddle --> check collision with bricks else @@ -804,7 +808,7 @@ public class LevelController resetMultiplicator(); timer.stop(); - game.getSoundHandler().play("finished_level"); + game.getSoundHandler().play(SoundType.FINISHED_LEVEL); Platform.runLater(() -> { Alert alert = new Alert(AlertType.INFORMATION); @@ -1044,7 +1048,9 @@ public class LevelController game.resetPointsSinceLastMultiplicatorReset(); game.setBoard(null); game.setLevelController(null); - game.setMovingPowerUps(new ArrayList<>()); + game.setMovingPowerUps(new ArrayList<>()); + + game.getSoundHandler().stopAll(); anchorPaneGame.requestFocus(); } diff --git a/src/de/bricked/ui/LevelPackSelectController.java b/src/de/bricked/ui/LevelPackSelectController.java index 56a96a17fd85132a26006219cf3aee879a2dfb3c..75dc7998873883f706ab54a734fbf55f09d2868a 100644 --- a/src/de/bricked/ui/LevelPackSelectController.java +++ b/src/de/bricked/ui/LevelPackSelectController.java @@ -28,6 +28,7 @@ import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.WindowEvent; import javafx.util.Callback; +import kuusisto.tinysound.TinySound; import logger.LogLevel; import logger.Logger; @@ -103,7 +104,9 @@ public class LevelPackSelectController { // TODO achievementhandling + TinySound.shutdown(); Platform.exit(); + System.exit(0); } }); diff --git a/src/de/bricked/ui/LevelSelectController.java b/src/de/bricked/ui/LevelSelectController.java index f266af1c9e0f619bbc300881b6424ff550d7cf1d..f29cb7c240f9ec8bc3c681180cbde7ee0a3e8688 100644 --- a/src/de/bricked/ui/LevelSelectController.java +++ b/src/de/bricked/ui/LevelSelectController.java @@ -30,6 +30,7 @@ import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.WindowEvent; import javafx.util.Callback; +import kuusisto.tinysound.TinySound; import logger.LogLevel; import logger.Logger; @@ -87,7 +88,9 @@ public class LevelSelectController { // TODO achievementhandling + TinySound.shutdown(); Platform.exit(); + System.exit(0); } });