2627282930313233343536373839
world.deleteEntity(e); } @Override 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(); } }
131132133134135136137138139
return e; } public static Entity createSound(World world, String soundFileName) { Entity sound = world.createEntity(); sound.addComponent(new SoundFile(soundFileName)); sound.addToWorld(); return sound; }