Skip to content
Snippets Groups Projects
Commit 689ea914 authored by Gehrung Jonas's avatar Gehrung Jonas
Browse files

UPDATE: one-time SoundEffects are running

parent e4664e43
No related branches found
No related tags found
3 merge requests!74V1,!73Initial commit,!71Merge DataBase into Development
...@@ -23,7 +23,6 @@ public class MusicPlayer { ...@@ -23,7 +23,6 @@ public class MusicPlayer {
private MediaPlayer mediaPlayer; private MediaPlayer mediaPlayer;
//Todo Make music play //Todo Make music play
public void playGameMusic(MusicType musicType) throws IOException { public void playGameMusic(MusicType musicType) throws IOException {
Path pathTypeOfMusic = Paths.get(musicType.getPath()); Path pathTypeOfMusic = Paths.get(musicType.getPath());
...@@ -33,7 +32,7 @@ public class MusicPlayer { ...@@ -33,7 +32,7 @@ public class MusicPlayer {
playMusicLoop(resource); playMusicLoop(resource);
} }
protected void playMusicLoop(String path ){ protected void playMusicLoop(String path){
Thread thread = new Thread(() -> { Thread thread = new Thread(() -> {
Media media = new Media(getClass().getResource(path).toExternalForm()); Media media = new Media(getClass().getResource(path).toExternalForm());
mediaPlayer = new MediaPlayer(media); mediaPlayer = new MediaPlayer(media);
......
package de.hdm_stuttgart.battlearena.Model.Sound; package de.hdm_stuttgart.battlearena.Model.Sound;
public enum SFX { public enum SFX {
GRASS("/sound/sfx/steps/grass"), BOOM("src/main/resources/sound/sfx/otSFX/explosion.mp3"),
STONE("/sound/sfx/steps/stone"), POWERUP("src/main/resources/sound/sfx/otSFX/powerup.mp3"),
COLLISION("/sound/sfx/collision"), COIN_COLLECTED("src/main/resources/sound/sfx/otSFX/drop-coins.mp3"),
ATTACK("/sound/sfx/attack"); SWORD_HIT("src/main/resources/sound/sfx/otSFX/sword-hit.mp3"),
COLLISION("src/main/resources/sound/sfx/otSFX/body-falling-to-ground.mp3");
private String path; private String path;
SFX(String path){ SFX(String path){
......
package de.hdm_stuttgart.battlearena.Model.Sound;
public enum SFXLoop {
GRASS("/sound/sfx/steps/grass"),
STONE("/sound/sfx/steps/stone"),
COLLISION("/sound/sfx/collision"),
ATTACK("/sound/sfx/attack");
private String path;
SFXLoop(String path){
this.path = path;
}
public String getPath(){
return path;
}
}
package de.hdm_stuttgart.battlearena.Model.Sound;
import javafx.scene.media.AudioClip;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
public class SoundEffects {
private static final Logger log = LogManager.getLogger(SoundEffects.class);
public void playSoundEffect(SFXLoop soundeffect){
}
public void playSoundEffectOnce(SFX soundEffect){
String path = soundEffect.getPath();
String resource = path.substring(18); // Begins at Ressource Folder
AudioClip audioClip = new AudioClip(getClass().getResource(resource).toExternalForm());
}
private void playSFXFile(String soundEffect){
}
}
File added
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment