public void run() { // Play song System.out.println("Playing song: " + song); songQueue.add(new File(song)); musicHome.refreshQueue(); musicPlayer.setSong(songQueue.remove(0)); musicHome.refreshQueue(); if (!musicPlayer.isPlaying()) { musicPlayer.play(-1); } t.cancel(); }
protected GameState updateThis(float et) { music.update(et); factory.update(et, player.getSpeed()); field.update(et); tunnel.update(et); float offset = -getNearClippingPlane() - player.getL() / 2; totalDistance += -player.getZ() + offset; distortion.translateZ(player, offset, player.getSpeed()); tunnel.translateZ(player, offset); field.translateZ(player, offset); if (player.isAlive()) { return this; } else if (fadeOut > 0) { fadeOut -= FADE_OUT_RATE * et; return this; } else { // TODO: Better end-of-game System.out.println("Game over!"); System.out.println("Your score: " + score); System.out.println("Your speed: " + player.getSpeed()); System.out.println("Your distance: " + totalDistance); return null; } }
public void run() { list.load(musicHome.getMusicDirectory().getAbsolutePath() + "/" + list.getName()); // add all songs in Playlist to queue, refresh, and play for (int i = 0; i < list.getSize(); i++) { list.setPosition(i); songQueue.add(new File(list.getCurrentSong())); } musicHome.refreshQueue(); musicPlayer.setSong(songQueue.remove(0)); musicHome.refreshQueue(); if (!musicPlayer.isPlaying()) { musicPlayer.play(-1); } t.cancel(); }