/** * @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(); }
/** * @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"); }
/** * 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); }
/** * @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"); }
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(); }
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); }
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); }
@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); }
/** * 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"); }
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; }
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 + ")"); } }
/** * 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; }
/** * Load WAVE file * @param name 登録名 * @param fileurl Filename (URL) * @return true if successful, false if failed */ public boolean load(String name, URL fileurl) { if(counter >= maxClips) { log.error("No more wav files can be loaded (" + maxClips + ")"); return false; } try { Sound clip = new Sound(fileurl); clipMap.put(name, clip); } catch(Throwable e) { log.error("Failed to load wav file", e); return false; } return true; }
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); } }
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(); } }
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { sound = new Sound(ResourceLoader.getResource("testdata/restart.ogg")); charlie = new Sound(ResourceLoader.getResource("testdata/cbrown01.wav")); engine = new Sound(ResourceLoader.getResource("testdata/engine.wav")); //music = musica = new Music("testdata/SMB-X.XM"); music = musica = new Music(ResourceLoader.getResource("testdata/restart.ogg"), false); musicb = new Music(ResourceLoader.getResource("testdata/kirby.ogg"), false); burp = new Sound(ResourceLoader.getResource("testdata/burp.aif")); }
@Override public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { mainMenu = new Music("res/menu.ogg"); click = new Sound("res/menuclick.ogg"); title = new Image("res/title.png"); title.setFilter(Image.FILTER_NEAREST); }
/** * Set sound file * @param snd Sound filename */ public void setSound(String snd) { try { this.snd = new Sound(snd); } catch (SlickException e) { e.printStackTrace(); } }
/** * 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(); } }
public void addSound(String key, String snd) throws SlickException { if(sounds != null) { AssetManager.ASSETS_TO_LOAD++; Sound sound = new Sound(snd); sounds.put(key, sound); AssetManager.ASSETS_LOADED++; System.out.println(String.format("Sound Loaded: %s", key)); } }
public Sound getSound(String key) { if((sounds != null) && (key != null) && (!key.equals(""))) { return sounds.get(key); } return null; }
public Player(float x, float y) throws SlickException { super(x, y); weapons = new LinkedList<Weapon>(); damage1 = System.currentTimeMillis(); damage2 = System.currentTimeMillis(); weaponIndex = 0; point = 0; height = 90; width = 60; key = false; sprites = setSprite(new Image("ressources/character/player/blue/p2_stand.png"), sprites); movingAnimations = setMovingAnimation(new Image[] { new Image("ressources/character/player/blue/p2_walk01.png"), new Image("ressources/character/player/blue/p2_walk02.png"), new Image("ressources/character/player/blue/p2_walk03.png"), new Image("ressources/character/player/blue/p2_walk04.png"), new Image("ressources/character/player/blue/p2_walk05.png"), new Image("ressources/character/player/blue/p2_walk06.png"), new Image("ressources/character/player/blue/p2_walk07.png"), new Image("ressources/character/player/blue/p2_walk08.png"), new Image("ressources/character/player/blue/p2_walk09.png"), new Image("ressources/character/player/blue/p2_walk10.png"), new Image("ressources/character/player/blue/p2_walk11.png") }, 50, movingAnimations); jumpSprite = setSprite(new Image("ressources/character/player/blue/p2_jump.png"), jumpSprite); hitedSprites = setSprite(new Image("ressources/character/player/blue/p2_hit.png"), hitedSprites); boundingShape = new AABoundingRect(x, y, width, height); accelerationSpeed = 0.002f; maximumSpeed = 0.55f; maximumFallSpeed = 0.6f; decelerationSpeed = 0.002f; life = 6; weapons.add(new Mitraillette(0, 0)); weapons.add(new LanceGrenade(0, 0)); weapons.add(new Uzi(0, 0)); jump = new Sound("ressources/audio/sound/jump.ogg"); coin = new Sound("ressources/audio/sound/coin.ogg"); }
public LanceGrenade(float x, float y) throws SlickException { super(x, y); munition = 50; cadence = 400; tir = new Sound("ressources/audio/sound/shoot.ogg"); arme = new Image("ressources/tiles/item/raygunPurpleBig.png"); // tir = new Sound("ressources/audio/sound/shoot.ogg"); }
public Uzi(float x, float y) throws SlickException { super(x, y); munition = 3000; cadence = 120; tir = new Sound("ressources/audio/sound/shoot.ogg"); arme = new Image("ressources/tiles/item/raygunBig.png"); }
public Mitraillette(float x, float y) throws SlickException { super(x, y); munition = 900; cadence = 125; tir = new Sound("ressources/audio/sound/shoot.ogg"); arme = new Image("ressources/tiles/item/raygun.png"); }