/** * @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"); }
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 + ")"); } }
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { super.update(container, game, delta); if (mResource != null) { try { mResource.load(); } catch (IOException e) { throw new SlickException("Failed to load: " + mResource.getDescription(), e); } mResource = null; } mRemaining = LoadingList.get().getRemainingResources(); mTotal = LoadingList.get().getTotalResources(); if (LoadingList.get().getRemainingResources() > 0) { mResource = LoadingList.get().getNext(); } else { ((Music)DatasManager.getInstance().getFile("Music.menu")).loop(); game.enterState(1, new FadeOutTransition(Color.black), new FadeInTransition(Color.black)); } }
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")); }
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { SoundStore.get().setMaxSources(32); myContainer = container; music = new Music("testdata/kirby.ogg", true); music.play(); }
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { music = new Music("testdata/restart.ogg", false); stream = new Music("testdata/restart.ogg", false); music.addListener(this); stream.addListener(this); }
@Override public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { credits = new Music("res/credits.ogg"); endTime = 0.0; for (CreditLine line : creditLines) { if (line.end > endTime) endTime = line.end; } }
@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); }
public void nextSong() throws SlickException { currentSong++; if(currentSong > SOUNDTRACK_LENGTH) currentSong = 1; String songName = String.format("soundtrack_%02d", currentSong); Music song = new Music(String.format("music/%s.ogg", songName)); if(song != null) { nowPlaying = song; nowPlaying.play(); } System.out.println("Playing next song: " + songName); }
@Override public void instanciation() throws SlickException { // ID for the next state (0 is main menu, ID+1 is the next level) player = new Player(2 * 70, 2 * 70); // Remplis ennemis ennemies.add(new SpinnerHalf(7 * 70, 4 * 70)); ennemies.add(new SpinnerHalf(9 * 70, 4 * 70)); ennemies.add(new Spider(34 * 70, 18 * 70)); ennemies.add(new SnakeLava(37 * 70, 16 * 70)); ennemies.add(new VoidFlyer(34 * 70, 2 * 70)); ennemies.add(new VoidFlyer(42 * 70, 6 * 70)); ennemies.add(new Ghost(19 * 70, 1 * 70)); // Remplis Objectifs objectives.add(new Coin(1 * 70, 16 * 70)); objectives.add(new Coin(42 * 70, 3 * 70)); objectives.add(new Coin(17 * 70, 15 * 70)); objectives.add(new Coin(16 * 70, 6 * 70)); objectives.add(new Key(18 * 70, 3 * 70)); // setup music (si rien, on garde la m�me musique qu'au niveau d'avant) musiclvl = new Music("ressources/audio/music/lvl5.ogg"); player.setWeapon(1); initialisationSuite(); }
@Override public void instanciation() throws SlickException { // ID for the next state (0 is main menu, ID+1 is the next level) player = new Player(2 * 70, 14 * 70); // Remplis ennemis ennemies.add(new Abeille(16 * 70, 1 * 70)); ennemies.add(new Abeille(42 * 70, 2 * 70)); ennemies.add(new SnakeLava(9 * 70, 14 * 70)); ennemies.add(new SnakeLava(13 * 70, 14 * 70)); ennemies.add(new SnakeLava(17 * 70, 14 * 70)); ennemies.add(new SpinnerHalf(17 * 70, 5 * 70)); ennemies.add(new SpinnerHalf(20 * 70, 5 * 70)); // Remplis Objectifs objectives.add(new Coin(17 * 70, 10 * 70)); objectives.add(new Coin(1 * 70, 8 * 70)); objectives.add(new Coin(36 * 70, 4 * 70)); objectives.add(new Coin(18 * 70, 4 * 70)); objectives.add(new Key(36 * 70, 11 * 70)); // setup music (si rien, on garde la m�me musique qu'au niveau d'avant) musiclvl = new Music("ressources/audio/music/lvl2.ogg"); player.setWeapon(2); initialisationSuite(); level.setBackground(new Image("ressources/background/moutain.png")); }
@Override public void instanciation() throws SlickException { // ID for the next state (0 is main menu, ID+1 is the next level) player = new Player(3 * 70, 15 * 70); // Remplis ennemis ennemies.add(new Ghost(16 * 70, 13 * 70)); ennemies.add(new Ghost(10 * 70, 9 * 70)); ennemies.add(new VoidFlyer(38 * 70, 15 * 70)); ennemies.add(new VoidFlyer(42 * 70, 9 * 70)); ennemies.add(new VoidFlyer(12 * 70, 2 * 70)); ennemies.add(new VoidFlyer(33 * 70, 5 * 70)); ennemies.add(new Spider(34 * 70, 18 * 70)); // Remplis Objectifs objectives.add(new Coin(1 * 70, 16 * 70)); objectives.add(new Coin(39 * 70, 16 * 70)); objectives.add(new Coin(35 * 70, 7 * 70)); objectives.add(new Coin(48 * 70, 8 * 70)); objectives.add(new Key(41 * 70, 11 * 70)); // setup music (si rien, on garde la m�me musique qu'au niveau d'avant) musiclvl = new Music("ressources/audio/music/lvl4.ogg"); player.setWeapon(0); initialisationSuite(); level.setBackground(new Image("ressources/background/forest.png")); }
@Override public void instanciation() throws SlickException { // at the start of the game we don't have a player yet player = new Player(1 * 70, 16 * 70); // Remplis ennmis ennemies.add(new Abeille(5 * 70, 6 * 70)); ennemies.add(new Abeille(26 * 70, 9 * 70)); ennemies.add(new Abeille(38 * 70, 9 * 70)); ennemies.add(new Spider(31 * 70, 17 * 70)); ennemies.add(new SnakeLava(15 * 70, 14 * 70)); // Remplis Objectifs objectives.add(new Coin(8 * 70, 6 * 70)); objectives.add(new Coin(23 * 70, 5 * 70)); objectives.add(new Coin(37 * 70, 10 * 70)); objectives.add(new Coin(35 * 70, 17 * 70)); objectives.add(new Key(6 * 70, 7 * 70)); // setup music musiclvl = new Music("ressources/audio/music/lvl1.ogg"); // set weapon player.setWeapon(0); // instanciation du level etc initialisationSuite(); // choix du background level.setBackground(new Image("ressources/background/desert.png")); }
@Override public void instanciation() throws SlickException { // ID for the next state (0 is main menu, ID+1 is the next level) player = new Player(1 * 70, 16 * 70); // Remplis ennemis ennemies.add(new Bat(7 * 70, 3 * 70)); ennemies.add(new Bat(2 * 70, 7 * 70)); ennemies.add(new Bat(26 * 70, 2 * 70)); ennemies.add(new Spider(15 * 70, 17 * 70)); ennemies.add(new SnakeLava(7 * 70, 16 * 70)); ennemies.add(new SpinnerHalf(10 * 70, 18 * 70)); // Remplis Objectifs objectives.add(new Coin(25 * 70, 2 * 70)); objectives.add(new Coin(2 * 70, 10 * 70)); objectives.add(new Coin(47 * 70, 6 * 70)); objectives.add(new Coin(36 * 70, 14 * 70)); objectives.add(new Key(43 * 70, 2 * 70)); // setup music (si rien, on garde la m�me musique qu'au niveau d'avant) musiclvl = new Music("ressources/audio/music/lvl3.ogg"); player.setWeapon(1); initialisationSuite(); level.setBackground(new Image("ressources/background/land.png")); }
@Override public void instanciation() throws SlickException { // ID for the next state (0 is main menu, ID+1 is the next level) player = new Player(2 * 70, 22 * 70); // Remplis ennemis ennemies.add(new Bat(3 * 70, 15 * 70)); ennemies.add(new Ghost(10 * 70, 12 * 70)); ennemies.add(new Bat(15 * 70, 10 * 70)); ennemies.add(new Ghost(31 * 70, 13 * 70)); ennemies.add(new Bat(46 * 70, 14 * 70)); ennemies.add(new Ghost(56 * 70, 6 * 70)); ennemies.add(new Bat(44 * 70, 3 * 70)); ennemies.add(new Ghost(21 * 70, 3 * 70)); ennemies.add(new Bat(4 * 70, 8 * 70)); ennemies.add(new Spider(20 * 70, 23 * 70)); ennemies.add(new Spider(30 * 70, 23 * 70)); ennemies.add(new Spider(40 * 70, 23 * 70)); ennemies.add(new Spider(50 * 70, 23 * 70)); // Remplis Objectifs objectives.add(new Coin(12 * 70, 20 * 70)); objectives.add(new Coin(31 * 70, 16 * 70)); objectives.add(new Coin(54 * 70, 11 * 70)); objectives.add(new Coin(29 * 70, 4 * 70)); objectives.add(new Key(15 * 70, 22 * 70)); // setup music (si rien, on garde la m�me musique qu'au niveau d'avant) musiclvl = new Music("ressources/audio/music/lvl6.ogg"); player.setWeapon(2); initialisationSuite(); }
@Override public void init(GameContainer container, StateBasedGame game) throws SlickException { // Background image background = new Image("ressources/background/background.jpg"); // Music deadMusic = new Music("ressources/audio/music/gameover.ogg"); // Sound rollover = new Sound("ressources/audio/sound/rollover.ogg"); // Cursor image cursor = new Image("ressources/cursor/hand_cursor.png"); // Color for button when mous is over Color color = new Color(255, 157, 67, 180); // Button "Quitter" Image quitterImage = new Image("ressources/menu/quitter.png"); quitter = new SlickButton(container, quitterImage, WindowGame.BASE_WINDOW_WIDTH / 2 - quitterImage.getWidth() / 2, 500, quitterImage.getWidth(), quitterImage.getHeight(), new ComponentListener() { @Override public void componentActivated(AbstractComponent arg0) { game.enterState(0); } }); quitter.setMouseOverColor(color); quitter.setMouseDownSound(rollover); }
@Override public void init() { timer = 0; tilemap = new TileMap(); Entity.removeAll(); Animation.removeAll(); new Player(GamePanel.WIDTH / 2 - 4, GamePanel.HEIGHT / 2 - 4); Stage.transitionStage(); if (!fadein) { new FadeIn().start(); fadein = true; } try { music_game = new Music(GamePanel.resfolder + "sound" + File.separator + "game.wav"); music_boss = new Music(GamePanel.resfolder + "sound" + File.separator + "bosstheme.wav"); } catch (SlickException e) { e.printStackTrace(); } music_game.play(1f, GamePanel.MUSIC_VOLUME); deadTimer = 60; Map.difficulty = 0; Generator.generate(); }
public static void init() throws SlickException { if (needInit == true) { musics = new HashMap<>(); musics.put(EnumSound.BACKGROUND, new Music(EnumSound.BACKGROUND.getPath())); musics.put(EnumSound.SELECT, new Music(EnumSound.SELECT.getPath())); pitch = 1.0f; volume = 1.0f; maxVolume = 2.0f; needInit = false; } }
public static void changeVolume(float value){ volume = value; for (Map.Entry<EnumSound, Music> entry : musics.entrySet()){ entry.getValue().setVolume(volume); } }
/** * 指定した numberのBGMをメモリ上に読み込み * @param no BGM number * @param showerr 例外が発生したときにコンソールに表示する */ public static void bgmLoad(int no, boolean showerr) { if(NullpoMinoSlick.propConfig.getProperty("option.bgm", false) == false) return; if(bgm[no] == null) { if(showerr) log.info("Loading BGM" + no); try { String filename = NullpoMinoSlick.propMusic.getProperty("music.filename." + no, null); if((filename == null) || (filename.length() < 1)) { if(showerr) log.info("BGM" + no + " not available"); return; } boolean streaming = NullpoMinoSlick.propConfig.getProperty("option.bgmstreaming", true); bgm[no] = new Music(filename, streaming); if(!showerr) log.info("Loaded BGM" + no); } catch(Throwable e) { if(showerr) log.error("BGM " + no + " load failed", e); else log.warn("BGM " + no + " load failed"); } } }