fixed sound handling bug

This commit is contained in:
2025-11-27 17:33:01 +01:00
parent 27ea2cb6d5
commit 67f2eeddf5

View File

@@ -30,7 +30,8 @@ public class GamePanel extends JPanel implements Runnable {
// SYSTEM // SYSTEM
TileManager tileM = new TileManager(this); TileManager tileM = new TileManager(this);
KeyHandler keyH = new KeyHandler(); KeyHandler keyH = new KeyHandler();
Sound sound = new Sound(); Sound se = new Sound();
Sound music = new Sound();
Thread gameThread; Thread gameThread;
public CollisionHandler collisionH = new CollisionHandler(this); public CollisionHandler collisionH = new CollisionHandler(this);
public AssetSetter assetSetter = new AssetSetter(this);; public AssetSetter assetSetter = new AssetSetter(this);;
@@ -102,18 +103,18 @@ public class GamePanel extends JPanel implements Runnable {
} }
public void playMusic(int i) { public void playMusic(int i) {
sound.setFile(i); music.setFile(i);
sound.play(); music.play();
sound.loop(); music.loop();
} }
public void stopMusic() { public void stopMusic() {
sound.stop(); music.stop();
} }
public void playSE(int i) { public void playSE(int i) {
sound.setFile(i); se.setFile(i);
sound.play(); se.play();
} }
} }