This commit is contained in:
parent
422542fe82
commit
de0924845d
@ -473,11 +473,9 @@ public class Game implements IGame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItem createItem(String sym) {
|
public IItem createItem(String sym) {
|
||||||
switch (sym) {
|
if (" ".equals(sym)) {
|
||||||
case " ":
|
|
||||||
return null;
|
return null;
|
||||||
default:
|
}// alternative/advanced method
|
||||||
// alternative/advanced method
|
|
||||||
Supplier<IItem> factory = itemFactories.get(sym);
|
Supplier<IItem> factory = itemFactories.get(sym);
|
||||||
if (factory != null) {
|
if (factory != null) {
|
||||||
return factory.get();
|
return factory.get();
|
||||||
@ -486,7 +484,6 @@ public class Game implements IGame {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayDebug(String s) {
|
public void displayDebug(String s) {
|
||||||
@ -538,14 +535,14 @@ public class Game implements IGame {
|
|||||||
if (lastMessages.size() > 2 && !thirdLineWritten) {
|
if (lastMessages.size() > 2 && !thirdLineWritten) {
|
||||||
printer.printAt(1, Main.LINE_MSG3, lastMessages.get(2));
|
printer.printAt(1, Main.LINE_MSG3, lastMessages.get(2));
|
||||||
}
|
}
|
||||||
System.out.println("Message: «" + s + "»");
|
//System.out.println("Message: «" + s + "»");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayStatus(String s) {
|
public void displayStatus(String s) {
|
||||||
printer.clearLine(Main.LINE_STATUS);
|
printer.clearLine(Main.LINE_STATUS);
|
||||||
printer.printAt(1, Main.LINE_STATUS, s);
|
printer.printAt(1, Main.LINE_STATUS, s);
|
||||||
System.out.println("Status: «" + s + "»");
|
//System.out.println("Status: «" + s + "»");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw() {
|
public void draw() {
|
||||||
|
@ -10,6 +10,7 @@ import inf101.v18.rogue101.objects.IActor;
|
|||||||
import inf101.v18.rogue101.objects.IItem;
|
import inf101.v18.rogue101.objects.IItem;
|
||||||
import inf101.v18.rogue101.objects.IPlayer;
|
import inf101.v18.rogue101.objects.IPlayer;
|
||||||
import inf101.v18.rogue101.states.Attack;
|
import inf101.v18.rogue101.states.Attack;
|
||||||
|
import javafx.scene.media.AudioClip;
|
||||||
import javafx.scene.media.Media;
|
import javafx.scene.media.Media;
|
||||||
import javafx.scene.media.MediaPlayer;
|
import javafx.scene.media.MediaPlayer;
|
||||||
|
|
||||||
@ -171,10 +172,8 @@ public class NPC {
|
|||||||
public static void playSound(String filename) {
|
public static void playSound(String filename) {
|
||||||
URL url = NPC.class.getClassLoader().getResource(filename);
|
URL url = NPC.class.getClassLoader().getResource(filename);
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
System.out.println("Playing " + url.toString());
|
AudioClip clip = new AudioClip(url.toString());
|
||||||
Media sound = new Media(url.toString());
|
clip.play();
|
||||||
MediaPlayer mediaPlayer = new MediaPlayer(sound);
|
|
||||||
mediaPlayer.play();
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Could not play audio file " + filename);
|
System.out.println("Could not play audio file " + filename);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user