Skip to content

improved sfx and replaced music as well as minor bug fixes #111

Merged
merged 2 commits into from
May 14, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ public enum Audio {
// Sound effects
OPEN_APP("/Audio/open_app.wav", true),
CLOSE_APP("/Audio/close_app.wav", true),
WARNING("/Audio/warning.wav", true),
CLOCK("/Audio/clock.wav", true),

// Background music
WEEKEND_THEME("/Audio/weekend_theme.mp3", false),
GAME_OVER_THEME("/Audio/game_over_theme.mp3", false);
WORK_THEME("/Audio/work_theme.mp3", false),
WEEKEND_THEME("/Audio/weekend_theme.mp3", false);

private String path;
private boolean isSFX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public void playBgMusic(Audio audio) {
stopBgMusic();
var url = getClass().getResource(audio.getPath()).toExternalForm();
bgPlayer = new MediaPlayer(new Media(url));
bgPlayer.setCycleCount(MediaPlayer.INDEFINITE);
bgPlayer.setVolume(0.5);
bgPlayer.play();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public void setGameState(GameState gameState) {
this.gameState = gameState;

if (gameState == GameState.WORKDAY && !workMusicPlaying) {
//audioManager.playBgMusic(Audio.WORK_THEME);
audioManager.playBgMusic(Audio.WORK_THEME);
workMusicPlaying = true;
weekendMusicPlaying = false;
}

if ((gameState == GameState.RENTDAY || gameState == GameState.FREEDAY) && !weekendMusicPlaying) {
if ((gameState == GameState.FREEDAY) && !weekendMusicPlaying) {
audioManager.playBgMusic(Audio.WEEKEND_THEME);
weekendMusicPlaying = true;
workMusicPlaying = false;
Expand All @@ -52,7 +52,7 @@ public void setGameState(GameState gameState) {
public void startGame() {
timer = new Timer(true);
final int delay = 0;
final int period = 10; //TODO: This has to be 1000 (1 second) on release
final int period = 1000; //TODO: This has to be 1000 (1 second) on release

timer.scheduleAtFixedRate(
new TimerTask() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public final class DesktopViewController {
private final GameOverApp gameOverApp = new GameOverApp();

private Runnable onGameOver;
private AudioManager audioManager = AudioManager.getInstance();

public DesktopViewController(final Player player, final GameController gameController) {
this.player = player;
Expand Down Expand Up @@ -211,7 +210,6 @@ private void showMarketClosedWarning() {

private void showWarning() {
warningApp.show();
audioManager.playSFX(Audio.WARNING);
desktopView.enterLayer(ModalLayer.WARNING);
}

Expand All @@ -222,7 +220,6 @@ private void dismissWarning() {

private void showGameOver() {
gameOverApp.show();
audioManager.playBgMusic(Audio.GAME_OVER_THEME);
desktopView.enterLayer(ModalLayer.GAME_OVER);
}

Expand Down
Binary file modified src/main/resources/Audio/clock.wav
Binary file not shown.
Binary file modified src/main/resources/Audio/close_app.wav
Binary file not shown.
Binary file removed src/main/resources/Audio/game_over_theme.mp3
Binary file not shown.
Binary file modified src/main/resources/Audio/open_app.wav
Binary file not shown.
Binary file removed src/main/resources/Audio/warning.wav
Binary file not shown.
Binary file modified src/main/resources/Audio/weekend_theme.mp3
Binary file not shown.
Binary file added src/main/resources/Audio/work_theme.mp3
Binary file not shown.