本文整理汇总了Java中org.newdawn.slick.Sound类的典型用法代码示例。如果您正苦于以下问题:Java Sound类的具体用法?Java Sound怎么用?Java Sound使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Sound类属于org.newdawn.slick包,在下文中一共展示了Sound类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.newdawn.slick.Sound; //导入依赖的package包/类
/**
* @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
*/
public void init(GameContainer container) throws SlickException {
SoundStore.get().setMaxSources(32);
myContainer = container;
sound = new Sound("testdata/restart.ogg");
charlie = new Sound("testdata/cbrown01.wav");
try {
engine = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream("testdata/engine.wav"));
} catch (IOException e) {
throw new SlickException("Failed to load engine", e);
}
music = musica = new Music("testdata/SMB-X.XM");
//music = musica = new Music("testdata/theme.ogg", true);
musicb = new Music("testdata/kirby.ogg", true);
burp = new Sound("testdata/burp.aif");
music.play();
}
示例2: init
import org.newdawn.slick.Sound; //导入依赖的package包/类
/**
* @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
*/
public void init(GameContainer container) throws SlickException {
LoadingList.setDeferredLoading(true);
new Sound("testdata/cbrown01.wav");
new Sound("testdata/engine.wav");
sound = new Sound("testdata/restart.ogg");
new Music("testdata/testloop.ogg");
music = new Music("testdata/SMB-X.XM");
new Image("testdata/cursor.png");
new Image("testdata/cursor.tga");
new Image("testdata/cursor.png");
new Image("testdata/cursor.png");
new Image("testdata/dungeontiles.gif");
new Image("testdata/logo.gif");
image = new Image("testdata/logo.tga");
new Image("testdata/logo.png");
new Image("testdata/rocket.png");
new Image("testdata/testpack.png");
font = new AngelCodeFont("testdata/demo.fnt", "testdata/demo_00.tga");
}
示例3: 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);
}
示例4: MazeModality
import org.newdawn.slick.Sound; //导入依赖的package包/类
/**
* @param mazeMap
* @param mazeView
* @throws SlickException
*/
public MazeModality(TiledMap mazeMap,MazeView mazeView) throws SlickException {
this.addObserver(mazeView);
tileWidth = mazeMap.getTileWidth();
tileHeight = mazeMap.getTileHeight();
mazeWidth = mazeMap.getWidth();
mazeHeight = mazeMap.getHeight();
initializationTiles(mazeView);
pacman = new PacMan(tileWidth, tileHeight, mazeWidth, tiles);
clyde = new Clyde(tileWidth, tileHeight, mazeWidth, tiles);
blinky = new Blinky(tileWidth, tileHeight, mazeWidth, tiles);
inky = new Inky(tileWidth, tileHeight, mazeWidth, tiles);
pinky = new Pinky(tileWidth, tileHeight, mazeWidth, tiles);
eatGhost = new Sound("data/pacmanSound/eatGhost.wav");
death = new Sound("data/pacmanSound/death.wav");
eatSuperPill = new Sound("data/pacmanSound/eatSuperPill.wav");
}
示例5: Weapon
import org.newdawn.slick.Sound; //导入依赖的package包/类
public Weapon(float x, float y) throws SlickException {
super(x, y);
way = Facing.LEFT;
playerFacing = Facing.RIGHT;
munition = 100; // remplacer par mun
x_velocity = 0;
y_velocity = 0;
cadence = 200;
arme = new Image("ressources/tiles/item/raygunBig.png");
boundingShape = new AABoundingRect(x, y, 0, 0);
maximumFallSpeed = 0;
tir = new Sound("ressources/audio/sound/shoot.ogg");
random = new Random();
}
示例6: Player
import org.newdawn.slick.Sound; //导入依赖的package包/类
public Player(int x, int y) {
super(x, y, 8, 8);
instance = this;
try {
sfx_shoot = new Sound(GamePanel.resfolder + "sound" + File.separator + "shoot.wav");
sfx_hit = new Sound(GamePanel.resfolder + "sound" + File.separator + "hit.wav");
} catch (SlickException e) {
e.printStackTrace();
}
heartBreak = Sprite.getAnimation(Sprite.HEARTBREAK, 180);
heartBreak.setLooping(false);
heartBreak.stop();
heartBreak.setCurrentFrame(heartBreak.getFrameCount() - 1);
deadly.add(Searcher.class);
deadly.add(Worm.class);
deadly.add(WormPart.class);
deadly.add(SearcherBoss.class);
deadly.add(SearcherBossPart.class);
deadly.add(Tower.class);
deadly.add(TowerBoss.class);
deadly.add(ClueTower.class);
}
示例7: 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);
}
示例8: init
import org.newdawn.slick.Sound; //导入依赖的package包/类
@Override
public void init() {
selected = 0;
amountOptions = 2;
image = Sprite.get("menu.png");
try {
sfx_select = new Sound(GamePanel.resfolder + "sound" + File.separator + "select.wav");
} catch (SlickException e) {
e.printStackTrace();
}
Entity.getEntities().clear();
play = new Rectangle(40, 50, 50, 24);
quit = new Rectangle(40, 86, 50, 24);
}
示例9: SoundPlayer
import org.newdawn.slick.Sound; //导入依赖的package包/类
/**
* Cria um novo tocador de sons.
* @throws SlickException
*/
public SoundPlayer() throws SlickException {
//Cria todos os sons necess�rios.
this.sndMovStep = new Sound("data/soundfx/mov-step.ogg");
this.sndMovPushing = new Sound("data/soundfx/mov-pushing.ogg");
this.sndMovJumpRising = new Sound("data/soundfx/mov-jump_rising.ogg");
this.sndMovJumpOnGround = new Sound("data/soundfx/mov-jump_ground.ogg");
this.sndActCatchingOrb = new Sound("data/soundfx/act-orb.ogg");
this.sndActSeasonsWheel = new Sound("data/soundfx/act-wheel.ogg");
this.sndActOnCreateDrawing = new Sound("data/soundfx/act-draw_create.ogg");
this.sndActFinishDrawing = new Sound("data/soundfx/act-draw_finish.ogg");
this.sndActHarpOnChangingSeasons = new Sound("data/soundfx/act-harp_seasons.ogg");
this.sndActSeasonChanged = new Sound("data/soundfx/act-season_changed.ogg");
this.sndActTremor = new Sound("data/soundfx/act_tremor.ogg");
this.sndplayActPlayerDeath = new Sound("data/soundfx/play-death.ogg");
this.sndplayActPlayerRevive = new Sound("data/soundfx/play-revive.ogg");
this.sndObjPendulumImpulse = new Sound("data/soundfx/obj-pendulum.ogg");
this.sndObjRotatorMotor = new Sound("data/soundfx/obj-rotator.ogg");
this.sndOthMenuOption = new Sound("data/soundfx/oth-menu_option.ogg");
}
示例10: play
import org.newdawn.slick.Sound; //导入依赖的package包/类
public static String play(EnumSound value) {
if (needInit == false) {
try {
Sound sound = new Sound(value.getPath());
if (sound != null) {
SoundElement soundElement = new SoundElement(sound, value);
sounds.add(soundElement);
soundElement.getSound().play(pitch, volume);
return soundElement.getId();
}
} catch (SlickException e) {
e.printStackTrace();
}
}
return null;
}
示例11: setResources
import org.newdawn.slick.Sound; //导入依赖的package包/类
private void setResources() throws SlickException {
for (Entry<Object, Object> e : mProperties.entrySet()) {
String key = (String)e.getKey();
String value = (String)e.getValue();
if (key.startsWith("Music")) {
DatasManager.getInstance().addFile(key,
new Music(ConfigsManager.getInstance().getProperties().getProperty("Resources.musicdir") + value));
} else if (key.startsWith("Sound")) {
DatasManager.getInstance().addFile(key,
new Sound(ConfigsManager.getInstance().getProperties().getProperty("Resources.sounddir") + value));
} else if (key.startsWith("Image")) {
Image img = new Image(ConfigsManager.getInstance().getProperties().getProperty("Resources.imagesdir") + value);
DatasManager.getInstance().addFile(key,
img);
}
Log.info("Added file to load: Key(" + key + ") Value(" + value + ")");
}
}
示例12: load
import org.newdawn.slick.Sound; //导入依赖的package包/类
/**
* Load WAVE file
* @param name 登録名
* @param filename Filename (String)
* @return true if successful, false if failed
*/
public boolean load(String name, String filename) {
if(counter >= maxClips) {
log.error("No more wav files can be loaded (" + maxClips + ")");
return false;
}
try {
Sound clip = new Sound(filename);
clipMap.put(name, clip);
} catch(Throwable e) {
log.error("Failed to load wav file", e);
return false;
}
return true;
}
示例13: loadSound
import org.newdawn.slick.Sound; //导入依赖的package包/类
private void loadSound() {
try {
for (int i = 0; i < ambiente.length; i++) {
ambiente[i] = new Sound("audio/" + i + ".ogg");
}
remate[0] = new Sound("audio/remate1.ogg");
remate[1] = new Sound("audio/remate2.ogg");
poste[0] = new Sound("audio/poste1.ogg");
poste[1] = new Sound("audio/poste2.ogg");
ovacion[0] = new Sound("audio/ovacion1.ogg");
ovacion[1] = new Sound("audio/ovacion2.ogg");
gol = new Sound("audio/gol.ogg");
rebote = new Sound("audio/rebote.ogg");
silbato = new Sound("audio/silbato.ogg");
} catch (Exception ex) {
logger.error("Error al cargar sonidos", ex);
}
}
示例14: init
import org.newdawn.slick.Sound; //导入依赖的package包/类
static public void init(){
try {
backgroundMusic = new Music("assets/sounds/soundeffects/bg1.ogg");
heart = new Sound("assets/sounds/soundeffects/heart.ogg");
backgroundMusic.loop();
backgroundMusic.setVolume(ConfigManager.musicVolume);
gunShot = new Sound("assets/sounds/soundeffects/gunshot.ogg");
robotAttack = new Sound("assets/sounds/soundeffects/robotattack.ogg");
footStep = new Sound("assets/sounds/soundeffects/footstep.ogg");
robotPunched = new Sound("assets/sounds/soundeffects/robotpunch.ogg");
playerPunched = new Sound("assets/sounds/soundeffects/punch.ogg");
explosion = new Sound("assets/sounds/soundeffects/explosion.ogg");
coin = new Sound("assets/sounds/soundeffects/coin.ogg");
} catch (SlickException e) {
e.printStackTrace();
}
}
示例15: loadSound
import org.newdawn.slick.Sound; //导入依赖的package包/类
private void loadSound() {
try {
for (int i = 0; i < ambiente.length; i++) {
ambiente[i] = new Sound("audio/" + i + ".ogg");
}
remate[0] = new Sound("audio/remate1.ogg");
remate[1] = new Sound("audio/remate2.ogg");
poste[0] = new Sound("audio/poste1.ogg");
poste[1] = new Sound("audio/poste2.ogg");
ovacion[0] = new Sound("audio/ovacion1.ogg");
ovacion[1] = new Sound("audio/ovacion2.ogg");
gol = new Sound("audio/gol.ogg");
rebote = new Sound("audio/rebote.ogg");
silbato = new Sound("audio/silbato.ogg");
} catch (Exception ex) {
logger.error("Error al cargar sonidos", ex);
}
}