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