3031323334353637383940
protected void added(Entity e) { SoundFile soundFile = soundMapper.get(e); try { Sound sound = new Sound(soundFile.getSoundFile()); sound.play(1, 0.3f); } catch (SlickException e1) { e1.printStackTrace(); } }
403404405406407408409410411412413
} public void playSound(String name) { Sound s = getSound(name); if (s != null) s.play(); } public void playSound(String name, float x, float y) { playSound(name, x, 1, y); }
1617181920212223242526
public static void playSound(String key) { Sound s; try { s = new Sound(key + EXT); s.play(); } catch (SlickException e) { System.out.println("Could not play sound : " + key + EXT); e.printStackTrace(); } }