本文整理汇总了Java中org.newdawn.slick.Sound.play方法的典型用法代码示例。如果您正苦于以下问题:Java Sound.play方法的具体用法?Java Sound.play怎么用?Java Sound.play使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.Sound
的用法示例。
在下文中一共展示了Sound.play方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.newdawn.slick.Sound; //导入方法依赖的package包/类
/**
* This method inizializes map, images, animations and sounds
* @param container
* @throws SlickException
*/
@Override
public void init(GameContainer container) throws SlickException {
ready = new Image("data/ready.jpg");
gameOver = new Image("data/gameover.png");
youWin = new Image("data/youwin.png");
mazeMap = new TiledMap("data/maze/Maze.tmx");
initMapProperty();
initAnimations();
begin = new Sound("data/pacmanSound/begin.wav");
begin.play();
eatFruit = new Sound("data/pacmanSound/eatFruit.wav");
pacmanGame.initMaze(mazeMap,this);
}
示例2: BloodSplatter
import org.newdawn.slick.Sound; //导入方法依赖的package包/类
public BloodSplatter(int x, int y) {
super();
for (int i = 0; i < amountSplat; i++) {
int size = r.nextInt(2) + 1;
Vector2D vel = new Vector2D((r.nextInt(800) - 400) / 100, (r.nextInt(800) - 400) / 100);
splatters.add(new Splat(x, y, size, vel));
}
try {
sfx_splat = new Sound(GamePanel.resfolder + "sound" + File.separator + "die.wav");
} catch (SlickException e) {
e.printStackTrace();
}
sfx_splat.play(1f, GamePanel.SFX_VOLUME);
}
示例3: play
import org.newdawn.slick.Sound; //导入方法依赖的package包/类
/**
* Play sound
* @param snd Sound filename
* @param looping Looping
* @param pitch Pitch
* @param volume Volume
*/
public static final void play(String snd, boolean looping, float pitch, float volume) {
try {
Sound s = new Sound(snd);
if (looping == true)
s.loop(pitch, volume);
else
s.play(pitch, volume);
} catch (SlickException e) {
e.printStackTrace();
}
}
示例4: playClick
import org.newdawn.slick.Sound; //导入方法依赖的package包/类
public static void playClick(){
try {
sound = new Sound("music/unit_select.ogg");
} catch (SlickException ex) {
}
sound.play(1.0F,0.2F);
}
示例5: playSwitch
import org.newdawn.slick.Sound; //导入方法依赖的package包/类
public static void playSwitch(){
try {
sound = new Sound("music/change_menu.ogg");
} catch (SlickException ex) {
}
sound.play(1.0F,0.2F);
}
示例6: playHover
import org.newdawn.slick.Sound; //导入方法依赖的package包/类
public static void playHover(boolean once){
try {
sound = new Sound("music/onmouseover.ogg");
} catch (SlickException ex) {
}
if (once) {
sound.play(1.0F, 1.0F);
}
}
示例7: play
import org.newdawn.slick.Sound; //导入方法依赖的package包/类
/**
* 再生
* @param name 登録名
*/
public void play(String name) {
// Nameに対応するクリップを取得
Sound clip = clipMap.get(name);
if(clip != null) {
clip.play();
}
}