add pacman sounds using jlayer library

master
ThirstyShark 6 years ago
parent d2245bfa0c
commit 4dacc0f19c

@ -1,4 +1,4 @@
#Tue, 05 Feb 2019 17:53:07 -0600 #Tue, 05 Feb 2019 18:09:27 -0600
C\:\\Users\\cd109\\Desktop\\CancerGrowth= C\:\\Users\\cd109\\Desktop\\CancerGrowth=

Binary file not shown.

BIN
dist/lib/jl1.0.1.jar vendored

Binary file not shown.

@ -29,10 +29,12 @@ dist.jar=${dist.dir}/CancerGrowth.jar
dist.javadoc.dir=${dist.dir}/javadoc dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath= endorsed.classpath=
excludes= excludes=
file.reference.jl1.0.1.jar=C:\\Users\\cd109\\Desktop\\jl1.0.1.jar
includes=** includes=**
jar.compress=false jar.compress=false
javac.classpath=\ javac.classpath=\
${libs.swing-layout.classpath} ${libs.swing-layout.classpath}:\
${file.reference.jl1.0.1.jar}
# Space-separated list of extra javac options # Space-separated list of extra javac options
javac.compilerargs= javac.compilerargs=
javac.deprecation=false javac.deprecation=false

@ -13,6 +13,11 @@ import java.awt.event.ActionListener;
import javax.swing.Timer; import javax.swing.Timer;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;
public class CellPanel extends javax.swing.JPanel implements ActionListener, ChangeListener public class CellPanel extends javax.swing.JPanel implements ActionListener, ChangeListener
{ {
@ -24,7 +29,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
private int pacmanx, pacmany; private int pacmanx, pacmany;
private int cycle; private int cycle;
private boolean cycledir = true; private boolean cycledir = true;
Player player;
ArrayList<Cell> cells = new ArrayList<Cell>(100000000); ArrayList<Cell> cells = new ArrayList<Cell>(100000000);
public CellPanel() public CellPanel()
@ -49,6 +54,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
//swingTimer.start(); //swingTimer.start();
pacmanx = 1050; pacmanx = 1050;
pacmany = -20; pacmany = -20;
} }
@Override @Override
@ -246,7 +252,19 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
} }
else { else {
kill = true; kill = true;
swingTimer.setDelay(25);
swingTimer.setDelay(10);
try {
FileInputStream fileInputStream = new FileInputStream("lib/pacman.mp3");
Player player = new Player(fileInputStream);
player.play();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JavaLayerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} }
}//GEN-LAST:event_jButton2ActionPerformed }//GEN-LAST:event_jButton2ActionPerformed

Loading…
Cancel
Save