Skip to content

Commit

Permalink
improved sfx and replaced music as well as minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
einaskoi committed May 14, 2026
1 parent b9f1fcc commit 333721e
Show file tree
Hide file tree
Showing 19 changed files with 13 additions and 18 deletions.
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
6 changes: 3 additions & 3 deletions src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Popup.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ private void loadStylesheets() {
);
} else {
root.getStylesheets().addAll(
resource("/css/global.css"),
resource("/css/popup.css"),
resource("/css/apps.css")
resource("/Style/global.css"),
resource("/Style/popup.css"),
resource("/Style/apps.css")
);
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ private void loadStylesheets() {
);
} else {
root.getStylesheets().addAll(
resource("/css/global.css"),
resource("/css/desktop.css"),
resource("/css/apps.css")
resource("/Style/global.css"),
resource("/Style/desktop.css"),
resource("/Style/apps.css")
);
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ private void loadStylesheets() {
);
} else {
root.getStylesheets().addAll(
getClass().getResource("/css/global.css").toExternalForm(),
getClass().getResource("/css/login.css").toExternalForm()
getClass().getResource("/Style/global.css").toExternalForm(),
getClass().getResource("/Style/login.css").toExternalForm()
);
}
} catch (Exception e) {
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 333721e

Please sign in to comment.