Old school code :-(

Hey,
I been writing my game and wanted to show somone my game. However i can only get the newer java vm to work on his computer. Well i been writing my code for an older version becuase JBuilder wouldnt configure properly.
Well, the game works but the buttons dont work and i get a white background instead of black in the newer java vm. but everything works in the old one.
Well i want to update my code to the newest java VM.
The one i been using is:
java version "1.2"
Classic VM (build JDK-1.2-V, native threads)
ok, i post my code and i be most thankfulif you can show me where i need to modify the code. There are images in the program which i feel are not needed, so if you wanna compile it and run it, just use random images or block the code that does it so it can be tested
OK, thanks in advance, sorry for the length of the program but i kinda kept it tidy and readable.
ALso sorry its not documented :-(
====spacy.java=================
//Title:      Space Shooter
//Version:   
//Copyright:  Copyright (c) 2004
//Author:     Tom Lorentsen
//Company:    MATX Software
//Description:Space shooter game
package spacy;
import javax.swing.UIManager;
import java.awt.*;
public class spacy {
  boolean packFrame = false;
  //Construct the application
  public spacy() {
    game frame = new game();
    //Validate frames that have preset sizes
    //Pack frames that have useful preferred size info, e.g. from their layout
    if (packFrame)
      frame.pack();
    else
      frame.validate();
    //Center the window
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    if (frameSize.height > screenSize.height)
      frameSize.height = screenSize.height;
    if (frameSize.width > screenSize.width)
      frameSize.width = screenSize.width;
    frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    frame.setBackground(Color.black);
    frame.setVisible(true);
  //Main method
  public static void main(String[] args) {
    //try  {
      //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    //catch(Exception e) {
    new spacy();
====game.java==================
//Title:      Space Shooter
//Version:
//Copyright:  Copyright (c) 2004
//Author:     Tom Lorentsen
//Company:    MATX Software
//Description:Space shooter game
package spacy;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.GraphicsDevice;
import java.util.Random;
import java.applet.*;
import java.io.*;
import java.net.URL;
public class game extends JFrame {
  BorderLayout borderLayout1 = new BorderLayout();
  CardLayout cc = new CardLayout();
  int gamespeed = 20;
  boolean ismenu = true;
  boolean isgame = false;
  int menuspace = -10;
  int menuchoice = 0;
  MediaTracker track = new MediaTracker(this);
  Image[] title = new Image[1];
  Image[] spaceships = new Image[10];
  Image[] planets = new Image[10];
  int[][] spaceshipsize = new int[10][2];
  boolean[] keys = new boolean[256];
  int[] playerpos = {10, 200};
  int weapon = 0;
  String[] weaponname = {"Laser","Dual Laser","Chain Gun","Flak","Homer","Blaster","Rail Gun","Bomb","9","10"};
  int[] weaponpower = { 1,1,1,4,4,4,15,15,1,1};
  int[] weaponammo = {0,0,100,100,100,100,100,100,100,100};
  int[] shield = {50,100,1};
  int[] chaingunpos = {0,0};
  int[][] playerlasers = new int[100][6];
  long bullettime = System.currentTimeMillis();
  int[][] ship = new int[100][5];
  long[] shiplasertimer = new long[100];
  int[] packet = {0,0,0};
  Random r = new Random();
  int maxship = 1;
  long score = 0;
  int level = 0;
  long nextscore = 1000;
  long multiplyertime = 0;
  int multiplyer = 1;
  boolean multiplyerok = false;
  boolean sleepy = false;
  int[][] shipspecs = {//Hits, Speed, Points, laser, timer
                      {  1   , 1    , 1     , 0        },
                      {  2   , 3    , 100   , 0         },
                      {  4   , 6    , 200   , 0         },
                      {  6   , 2    , 300   , 0         },
  int spacepos = 0;
  int[][] planetpos = {{100,200,0},{600,300,1},{1000,150,2},{1500,200,0}};
  Graphics bufferGraphics;
  Image offscreen;
  Dimension dim;
  Font bigtext = new Font("Tahoma",Font.BOLD,20);
  Font smalltext = new Font("Tahoma",Font.BOLD,12);
  //Construct the frame
  public game() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try  {
      jbInit();
    catch(Exception e) {
      e.printStackTrace();
  //Component initialization
  private void jbInit() throws Exception  {
    this.getContentPane().setLayout(borderLayout1);
    this.getContentPane().setBackground(Color.black);
    this.setSize(new Dimension(600, 500));
    this.setTitle(".:Space Shooter:.");
    addKeyListener(new java.awt.event.KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        this_keyPressed(e);
      public void keyReleased(KeyEvent e) {
        this_keyReleased(e);
    new Thread(new display()).start();
    new Thread(new animatemenu()).start();
    new Thread(new menuchoiceselection()).start();
    Toolkit kit = Toolkit.getDefaultToolkit();
    spaceships[0] = kit.getImage("littleship.gif");
    //URL imageResource = getClass().getResource("/littleship.gif");
      //spaceships[0] = kit.getImage(imageResource);
    track.addImage(spaceships[0],0);
    spaceships[1] = kit.getImage("littleship1.gif");
    //imageResource = getClass().getResource("/littleship1.gif");
      //spaceships[1] = kit.getImage(imageResource);
    track.addImage(spaceships[1],1);
    spaceships[2] = kit.getImage("littleship2.gif");
    //imageResource = getClass().getResource("/littleship2.gif");
      //spaceships[2] = kit.getImage(imageResource);
    track.addImage(spaceships[2],2);
    spaceships[3] = kit.getImage("littleship3.gif");
    //imageResource = getClass().getResource("/littleship3.gif");
      //spaceships[3] = kit.getImage(imageResource);
    track.addImage(spaceships[3],3);
    planets[0] = kit.getImage("planet1.jpg");
    //imageResource = getClass().getResource("/planet1.gif");
      //spaceships[4] = kit.getImage(imageResource);
    track.addImage(planets[0],4);
    planets[1] = kit.getImage("planet2.jpg");
    //imageResource = getClass().getResource("/planet2.gif");
      //spaceships[5] = kit.getImage(imageResource);
    track.addImage(planets[1],5);
    planets[2] = kit.getImage("planet3.jpg");
    //imageResource = getClass().getResource("/planet2.gif");
      //spaceships[5] = kit.getImage(imageResource);
    track.addImage(planets[2],6);
    title[0] = kit.getImage("spaceshooter.gif");
    track.addImage(title[0],7);
    System.out.println("Loading map images");
    try {
      track.waitForAll();
    } catch (InterruptedException e){}
    System.out.println("Loaded map images");
    spaceshipsize[0][0] = 20;
    spaceshipsize[0][1] = 20;
    spaceshipsize[1][0] = 15;
    spaceshipsize[1][1] = 15;
    spaceshipsize[2][0] = 15;
    spaceshipsize[2][1] = 20;
    spaceshipsize[3][0] = 25;
    spaceshipsize[3][1] = 32;
    //this.getContentPane().add(jPanel1, BorderLayout.CENTER);
    this.getContentPane().setLayout(cc);
    jPanel1.setBackground(Color.black);
    jPanel2.setBackground(Color.black);
    this.getContentPane().add(jPanel1, "jPanel1");
    this.getContentPane().add(jPanel2, "jPanel2");
    cc.show(this.getContentPane(),"jPanel1");
  //Overridden so we can exit on System Close
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if(e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
  JPanel jPanel1 = new JPanel() {
    public void paintComponent(Graphics g) {
      Graphics2D c = (Graphics2D)g;
      c.clearRect(0,0,jPanel1.getWidth(),jPanel1.getHeight());
      c.setColor(Color.blue);
      c.fillRoundRect((jPanel1.getWidth()/2)-50,186 + (menuchoice*20),100,20,5,5);
      c.setColor(Color.black);
      //c.drawLine(menuspace,100,menuspace+10,105);
      //c.drawLine(menuspace,110,menuspace+10,105);
      c.drawImage(spaceships[0],menuspace,105,this);
      c.setColor(Color.white);
      c.drawImage(title[0],(jPanel1.getWidth() - 482)/2,20,this);
      c.drawString("START",(jPanel1.getWidth()/2)-20,200);
      c.drawString("CONTINUE",(jPanel1.getWidth()/2)-32,220);
      c.drawString("HIGH SCORES",(jPanel1.getWidth()/2)-44,240);
      c.drawString("OPTIONS",(jPanel1.getWidth()/2)-28,260);
      c.drawString("CHEATS",(jPanel1.getWidth()/2)-24,280);
      c.drawString("EXIT",(jPanel1.getWidth()/2)-16,300);
      c.drawString("Programming by Thomas Lorentsen",(jPanel1.getWidth()/2)-104,jPanel1.getHeight()-20);
      c.drawString("Graphics by Craig Taft",(jPanel1.getWidth()/2)-77,jPanel1.getHeight()-5);
//-------------------------panel------------------------------------------------
  JPanel jPanel2 = new JPanel() {
    public void paintComponent(Graphics g) {
      dim = getSize();
      offscreen = createImage(dim.width,dim.height);
      bufferGraphics = offscreen.getGraphics();
      Graphics2D c = (Graphics2D)g;
      bufferGraphics.clearRect(0,0,dim.width,dim.height);
      for (int i = 0; i!=4;i++) {
        if (-50 < planetpos[1] && 600 > planetpos[i][1]) {
bufferGraphics.drawImage(planets[planetpos[i][2]],planetpos[i][0]-spacepos,planetpos[i][1],this);
//bufferGraphics.clearRect(0,0,jPanel2.getWidth(),jPanel2.getHeight());
bufferGraphics.setColor(Color.white);
bufferGraphics.drawImage(spaceships[0],playerpos[0]-15,playerpos[1]-15,this);
if (weapon == 2) {
bufferGraphics.drawLine(playerpos[0]+7,playerpos[1]+chaingunpos[0],playerpos[0]+11,playerpos[1]+chaingunpos[0]);
for (int i = 0; i != 100; i++) {
if (playerlasers[i][0] > 0) {
if(playerlasers[i][2] == 0) {
bufferGraphics.setColor(Color.yellow);
bufferGraphics.drawLine(playerlasers[i][0]-5,playerlasers[i][1],playerlasers[i][0],playerlasers[i][1]);
else if(playerlasers[i][2] == 1) {
bufferGraphics.setColor(Color.green);
bufferGraphics.drawLine(playerlasers[i][0]-5,playerlasers[i][1],playerlasers[i][0],playerlasers[i][1]);
else if(playerlasers[i][2] == 2) {
bufferGraphics.setColor(Color.getHSBColor(100,100,20));
bufferGraphics.drawLine(playerlasers[i][0]-3,playerlasers[i][1],playerlasers[i][0],playerlasers[i][1]);
else if(playerlasers[i][2] == 3) {
bufferGraphics.setColor(Color.white);
bufferGraphics.drawLine(playerlasers[i][0]-3,playerlasers[i][1],playerlasers[i][0],playerlasers[i][1]);
else if(playerlasers[i][2] == 4) {
bufferGraphics.setColor(Color.green);
bufferGraphics.drawLine(playerlasers[i][0]-5,playerlasers[i][1]-2,playerlasers[i][0],playerlasers[i][1]);
bufferGraphics.drawLine(playerlasers[i][0]-5,playerlasers[i][1]+2,playerlasers[i][0],playerlasers[i][1]);
//bufferGraphics.drawString("Ship: " + playerlasers[3],playerlasers[i][0],playerlasers[i][1]+15);
else if(playerlasers[i][2] == 5) {
bufferGraphics.setColor(Color.yellow);
bufferGraphics.drawRoundRect(playerlasers[i][0]-1,playerlasers[i][1]-1,3,3,3,3);
bufferGraphics.setColor(Color.red);
bufferGraphics.drawRect(playerlasers[i][0],playerlasers[i][1],0,0);
else if(playerlasers[i][2] == 6) {
bufferGraphics.setColor(Color.yellow);
bufferGraphics.drawLine(playerlasers[i][0]-5,playerlasers[i][1],playerlasers[i][0],playerlasers[i][1]);
bufferGraphics.setColor(Color.yellow);
bufferGraphics.drawLine(playerlasers[i][0]+playerlasers[i][3],playerlasers[i][1],playerlasers[i][0]+playerlasers[i][3]+5,playerlasers[i][1]+5);
else if(playerlasers[i][2] == 7) {
bufferGraphics.setColor(Color.yellow);
bufferGraphics.drawRoundRect(playerlasers[i][0]-5,playerlasers[i][1]-5,10,10,5,5);
bufferGraphics.setColor(Color.yellow);
//Enemy lasers
else if(playerlasers[i][2] == 50) {
bufferGraphics.setColor(Color.green);
bufferGraphics.drawLine(playerlasers[i][0],playerlasers[i][1],playerlasers[i][0]-5,playerlasers[i][1]);
if (packet[0] > 0) {
bufferGraphics.setColor(Color.yellow);
bufferGraphics.fillRect(packet[0],packet[1]-5,10,10);
bufferGraphics.setColor(Color.white);
for (int i = 0; i != 50; i++) {
if (ship[i][0] > 0) {
bufferGraphics.drawImage(spaceships[ship[i][2]],ship[i][0],ship[i][1]-15 ,this);
//else {
//break;
bufferGraphics.setFont(bigtext);
bufferGraphics.drawString("Score: " + score + " X " + multiplyer, 20, 20);
bufferGraphics.drawString("Level: " + level, 500, 20);
bufferGraphics.drawString("Weapon: " + weaponname[weapon], 300, 20);
bufferGraphics.setFont(smalltext);
bufferGraphics.drawRect(75,25,shield[1],14);
bufferGraphics.drawString("Shield",25,38);
bufferGraphics.fillRect(75,25,shield[0],14);
bufferGraphics.setFont(smalltext);
bufferGraphics.drawRect(260,25,weaponammo[weapon],14);
bufferGraphics.drawString("Ammo",200,38);
bufferGraphics.fillRect(260,25,weaponammo[weapon],14);
bufferGraphics.setColor(Color.black);
bufferGraphics.drawString(""+weaponammo[weapon],270,38);
if (keys[107] == true || keys[109] == true) {
bufferGraphics.setColor(Color.green);
bufferGraphics.drawString("Speed: " + gamespeed, 250,250);
c.drawImage(offscreen,0,0,this);
class display implements Runnable {
public void run() {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
while(true) {
repaint();
//try {
//Thread.sleep(1);
//} catch (InterruptedException e){}
//sleepy = false;
class animatemenu implements Runnable {
public void run() {
while(ismenu == true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e){}
menuspace+=10;
if (menuspace > jPanel1.getWidth()) {
menuspace = -10;
//=============================GAME=============================================
class gamebuttons implements Runnable {
boolean slowdown = false;
private long timer = 0;
public void run() {
//Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
while(isgame == true) {
for (int i = 0; i != 100; i++) {
if (playerlasers[i][0] > 500 || playerlasers[i][0] < 0) {
playerlasers[i][0] = 0;
else if (playerlasers[i][0] > 0) {
if (playerlasers[i][2] == 3) {
playerlasers[i][1]+=playerlasers[i][3];
playerlasers[i][0]+=10;
if (playerlasers[i][2] == 4) {
if (ship[playerlasers[i][3]][0] < playerlasers[i][0]) {
int pX = playerlasers[i][0];
int pY = playerlasers[i][1];
int closeNdx = -1;
int closeSq = Integer.MAX_VALUE;
for (int ii = 0; ii != maxship; ii++) {
int dx = pX - ship[ii][0];
int dy = pY - ship[ii][1];
int distSq = dx * dx + dy * dy;
if (distSq < closeSq) {
closeNdx = ii;
closeSq = distSq;
playerlasers[i][3] = closeNdx;
playerlasers[i][0]+=5;
else {
int temp1 = ship[playerlasers[i][3]][0]-playerlasers[i][0];
int temp2 = ship[playerlasers[i][3]][1]-playerlasers[i][1];
playerlasers[i][0]+=5;
if (temp1 != 1 && temp1 != 0 && temp2 != 0) {
playerlasers[i][1]+= temp2/5;
if (playerlasers[i][2] == 7) {
if (ship[playerlasers[i][3]][0] < playerlasers[i][0]) {
int pX = playerlasers[i][0];
int pY = playerlasers[i][1];
int closeNdx = -1;
int closeSq = Integer.MAX_VALUE;
for (int ii = 0; ii != maxship; ii++) {
int dx = pX - ship[ii][0];
int dy = pY - ship[ii][1];
int distSq = dx * dx + dy * dy;
if (distSq < closeSq) {
closeNdx = ii;
closeSq = distSq;
playerlasers[i][4] = closeNdx;
playerlasers[i][0]+=5;
else {
int temp1 = ship[playerlasers[i][4]][0]-playerlasers[i][0];
int temp2 = ship[playerlasers[i][4]][1]-playerlasers[i][1];
playerlasers[i][0]+=5;
if (temp1 != 1 && temp1 != 0 && temp2 != 0) {
playerlasers[i][1]+= temp2/5;
else if (playerlasers[i][2] == 6) {
playerlasers[i][0]+=10;
if (playerlasers[i][3] == 4)
playerlasers[i][3] = -1;
playerlasers[i][3]++;
else if (playerlasers[i][2] == 50) {
playerlasers[i][0]-=playerlasers[i][3];
else {
playerlasers[i][0]+=10;
for (int ii = 0; ii != maxship; ii++){
if (playerlasers[i][0] != 0 && playerlasers[i][0] > ship[ii][0]-spaceshipsize[ship[ii][2]][0] && playerlasers[i][0] < ship[ii][0]+spaceshipsize[ship[ii][2]][0] && playerlasers[i][1] > ship[ii][1]-spaceshipsize[ship[ii][2]][1] && playerlasers[i][1] < ship[ii][1]+spaceshipsize[ship[ii][2]][1] && playerlasers[i][2] < 50){
ship[ii][3]-= weaponpower[weapon];
if (playerlasers[i][2] == 7) {
littlemines(playerlasers[i][0],playerlasers[i][1],shipspecs[ship[ii][2]][0],playerlasers[i][3]);
if (ship[ii][3] <= 0) {
ship[ii][0] = 0;
if (multiplyertime > System.currentTimeMillis()) {
multiplyer++;
multiplyerok = true;
new Thread(new multiply()).start();
multiplyertime = System.currentTimeMillis()+1000;
//maxship++;
score+= shipspecs[ship[ii][2]][2]*multiplyer;
if (score >= nextscore) {
level++;
nextscore*=2;
maxship++;
playerlasers[i][0] = 0;
playerlasers[i][1] = 0;
playerlasers[i][2] = 0;
playerlasers[i][3] = 0;
else if (playerlasers[i][0] != 0 && playerlasers[i][0] > playerpos[0]-spaceshipsize[0][0] && playerlasers[i][0] < playerpos[0]+spaceshipsize[0][0] && playerlasers[i][1] > playerpos[1]-spaceshipsize[0][1] && playerlasers[i][1] < playerpos[1]+spaceshipsize[0][1] && playerlasers[i][2] > 49) {
shield[0] = 0;
for (int i = 0; i != maxship; i++) {
if (ship[i][0] <= 0) {
ship[i][0] = 500;
ship[i][1] = r.nextInt(400)+50;
ship[i][2] = r.nextInt(3)+1;
ship[i][3] = shipspecs[ship[i][2]][0];
break;
else {
ship[i][0]-=shipspecs[ship[i][2]][1];
if (r.nextInt(50) == 0 && shiplasertimer[i] < System.currentTimeMillis()) {
enemylaser(i);
if (r.nextInt(100) == 0 && packet[0] == 0) {
packet[0] = 500;
packet[1] = r.nextInt(400)+50;
packet[2] = 1;
if (packet[0] <= 0) {
packet[0] = 0;
else if (packet[0] >0) {
packet[0]-=1;
if (packet[0] > playerpos[0]-spaceshipsize[0][0] && packet[0] < playerpos[0]+spaceshipsize[0][0] && packet[1] > playerpos[1]-spaceshipsize[0][1] && packet[1] < playerpos[1]+spaceshipsize[0][1]) {
packet[0] = 0;
weaponammo[weapon]+=100;
if (keys[32] == true && bullettime < System.currentTimeMillis()) {
if (weapon == 0 && shield[0] > 10)
laser();
else if (weapon == 1 && shield[0] > 20)
duallaser();
else if (weapon == 2 && weaponammo[weapon] > 1)
chaingun();
else if (weapon == 3 && weaponammo[weapon] > 1)
flak();
else if (weapon == 4 && weaponammo[weapon] > 1)
homer();
else if (weapon == 5 && weaponammo[weapon] > 1)
blaster();
else if (weapon == 6 && weaponammo[weapon] > 1)
railgun();
else if (weapon == 7 && weaponammo[weapon] > 1)
mine();
if (shield[0] < shield[1])
shield[0]+= shield[2];
if (keys[38] == true && playerpos[1] > 50) {
playerpos[1]-=5;
else if (keys[40] == true && playerpos[1] < 450) {
playerpos[1]+=5;
if (keys[37] == true && playerpos[0] > 30) {
playerpos[0]-=3;
else if (keys[39] == true && playerpos[0] < 500) {
playerpos[0]+=3;
if (keys[49] == true) {
weapon = 0;
else if (keys[50] == true) {
weapon = 1;
else if (keys[51] == true) {
weapon = 2;
else if (keys[52] == true) {
weapon = 3;
else if (keys[53] == true) {
weapon = 4;
else if (keys[54] == true) {
weapon = 5;
else if (keys[55] == true) {
weapon = 6;
else if (keys[56] == true) {
weapon = 7;
else if (keys[57] == true) {
weapon = 8;
else if (keys[58] == true) {
weapon = 9;
else if (keys[48] == true) {
weapon = 10;
else if (keys[97] == true) {
weaponammo[weapon]+=100;
else if (keys[98] == true) {
score+=1000;
else if (keys[99] == true) {
level++;
else if (keys[100] == true) {
maxship++;
else if (keys[101] == true) {
shield[2]++;
else if (keys[107] == true) {
gamespeed++;
else if (keys[109] == true && gamespeed > 1) {
gamespeed--;
else if (keys[27] == true && gamespeed > 1) {
isgame = false;
ismenu = true;
menuchoice = 1;
new Thread(new animatemenu()).start();
new Thread(new menuchoiceselection()).start();
setpanel("jPanel1");
try {
Thread.sleep(gamespeed);
} catch (InterruptedException e){}
spacepos+=1;
if (spacepos > 1600)
spacepos = 0;
class multiply implements Runnable {
public void run() {
//Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
multiplyerok = false;
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {}
if (multiplyerok == false) {
multiplyer = 1;
class menuchoiceselection implements Runnable {
public void run() {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
while(ismenu == true) {
try {
Thread.sleep(1);
} catch (InterruptedException e){}
if (keys[38] == true && menuchoice > 0) {
menuchoice--;
try {
Thread.sleep(200);
} catch (InterruptedException e){}
else if (keys[40] == true && menuchoice < 5) {
menuchoice++;
try {
Thread.sleep(200);
} catch (InterruptedException e){}
else if (keys[10] == true && menuchoice == 0) {
System.out.println("Play");
ismenu = false;
isgame = true;
reset();
//new Thread(new bg()).start();
new Thread(new gamebuttons()).start();
//new Thread(new animategame()).start();
setpanel("jPanel2");
else if (keys[10] == true && menuchoice == 1) {
System.out.println("Continue");
ismenu = false;
isgame = true;
//new Thread(new bg()).start();
new Thread(new gamebuttons()).start();
//new Thread(new animategame()).start();
setpanel("jPanel2");
else if (keys[10] == true && menuchoice == 2) {
System.out.println("High scores");
else if (keys[10] == true && menuchoice == 3) {
System.out.println("Options");
else if (keys[10] == true && menuchoice == 4) {
System.out.println("Cheats");
cheat();
else if (keys[10] == true && menuchoice == 5) {
System.out.println("BOOM");
System.exit(0);
void this_keyPressed(KeyEvent e) {
keys[e.getKeyCode()] = true;
//System.out.println("Key: \t" + e.getKeyCode());
void this_keyReleased(KeyEvent e) {
keys[e.getKeyCode()] = false;
void setpanel(String panel) {
cc.show(this.getContentPane(),panel);
void cheat() {
String cheater = JOptionPane.showInputDialog(this,"Enter Cheat","Cheat",JOptionPane.QUESTION_MESSAGE);
if (cheater.equals("giveall")) {
String ok = JOptionPane.showInputDialog(this,"Cheat Accepted","Cheat",JOptionPane.OK_OPTION);
void laser() {
bullettime = System.currentTimeMillis()+250;
for (int i = 0; i!=100;i++) {
if (playerlasers[i][0] == 0){
playerlasers[i][0] = playerpos[0]+20;
playerlasers[i][1] = playerpos[1];
playerlasers[i][2] = 0;
shield[0]-=10;
break;
void duallaser() {
bullettime = System.currentTimeMillis()+250;
int count = 0;
for (int i = 0; i!=100;i++) {
if (playerlasers[i][0] == 0){
if (count == 0) {
playerlasers[i][0] = playerpos[0]+20;
playerlasers[i][1] = playerpos[1]-5;
playerlasers[i][2] = 1;
count++;
else if (count == 1) {
playerlasers[i][0] = playerpos[0]+20;
playerlasers[i][1] = playerpos[1] +5;
playerlasers[i][2] = 1;
shield[0]-=20;
break;
void chaingun(){
bullettime = System.currentTimeMillis()+100;
if (chaingunpos[0] >= 8)
chaingunpos[1] = 1;
else if (chaingunpos[0] <= -8)
chaingunpos[1] = 0;
if (chaingunpos[1] == 0)
chaingunpos[0]+= 3;
else if (chaingunpos[1] == 1)
chaingunpos[0]-= 3;
for (int i = 0; i!=100;i++) {
if (playerlasers[i][0] == 0){
playerlasers[i][0] = playerpos[0]+20;
playerlasers[i][1] = playerpos[1]+chaingunpos[0];
playerlasers[i][2] = 2;
weaponammo[weapon]--;
break;
void flak(){
bullettime = System.currentTimeMillis()+1000;
int count = -10;
for (int i = 0; i!=100;i++) {
if (playerlasers[i][0] == 0){
if (count < 5) {
//playerlasers[i][0] = playerpos[0]+20;
//playerlasers[i][1] = playerpos[1]+count;
playerlasers[i][0] = playerpos[0]+r.nextInt(10)+10;
playerlasers[i][1] = playerpos[1]+(r.nextInt(10)-5);
playerlasers[i][2] = 3;
playerlasers[i][3] = count;
if (count == 10) {
weaponammo[weapon]-=10;
break;
count+=2;
void homer() {
bullettime = System.currentTimeMillis()+500;
int[] small = {10000,10000};
for (int i = 0; i!=100;i++) {
if (playerlasers[i][0] == 0){
playerlasers[i][0] = playerpos[0]+20;
playerlasers[i][1] = playerpos[1];
playerlasers[i][2] = 4;
weaponammo[weapon]-=1;
int pX = playerpos[0];
int pY = playerpos[1];
int closeNdx = -1;
int closeSq = Integer.MAX_VALUE;
for (int ii = 0; ii != maxship; ii++) {
int dx = pX - ship[ii][0];
int dy = pY - ship[ii][1];
int distSq = dx * dx + dy * dy;
if (distSq < closeSq) {
closeNdx = ii;
closeSq = distSq;
playerlasers[i][3] = closeNdx;
break;
void blaster() {
bullettime = System.currentTimeMillis()+100;
for (int i = 0; i!=100;i++) {
if (playerlasers[i][0] == 0){
playerlasers[i][0] = playerpos[0]+20;
playerlasers[i][1] = playerpos[1]+(r.nextInt(5)-2);
playerlasers[i][2] = 5;
weaponammo[weapon]--;
break;
void railgun() {
bullettime = System.currentTimeMillis()+300;
for (int i = 0; i!=100;i++) {
if (playerlasers[i][0] == 0){
playerlasers[i][0] = playerpos[0]+20;
playerlasers[i][1] = playerpos[1];
playerlasers[i][2] = 6;
playerl

Did you get any compile errors?
Are you getting any messages/exceptions at runtime?
The same code, compiled with a jdk 1.2 works fine?
(( You've tested this.. (my thought is that maybe somewhere you changed something but didn't recompile that has no broken execution...) you've compiled those specific files with the old jdk, just to make sure))

Similar Messages

  • New to JAVA, but old school to programming

    Objects & Classes & Methods, Oh my!
    I'm pretty new to java, but I've been programming in several languages over the years. I thought it was about time to update my skill set, especially with the job market as it is today. I wanted to go JAVA because it's not specific to any environment.
    I picked up a begining JAVA book and was a little confused. When I was learning programming a program was called a program. a peice of code in a program called by a statement was called a subroutine (it was performed then control returned to the calling line and continued).
    Now I'm trying to make sense of everything I have read so far and trying to relate it back to my old school of thinking. I was hoping it would make it easier to retain and I could expand it as I learn and possibly realize that it IS different. I know it's a new way of thinking, but stay with me for minute.
    What I used to call a program is now a CLASS in JAVA (this can be a collection of code or other objects). A sub-routine in a CLASS is a Method. I know that the language part will come as I use it since I understand if's then's and whatever you use to gosub or goto, but I want to make sure I have down the lingo before I go to deep.

    I have no idea how you can compare Java to Cobol.
    DataFlex? How about that! In about '84 I switched to
    DataFlex from dBaseII. In '91 DataFlex changed from
    procedural to OOP. It took most of us at least a year
    to adjust, and then some to write concrete code. It
    was tough. They had bugs and we were limited with DOS.
    BUT, it was a great OOP training experience. Anyhow,
    needless to day Java is miles ahead on all fronts.Small world. I was stuck in the old DataFlex Ver 2.3 at that time. The company I worked for had the newer OOP package. I did get to work with it some, but not enough to become totally familiar with it. We started to move out of DataFlex towards PowerBuilder towards the end of 1995. I did get some OOP from that experience, but again only enough to learn about global variables, instance variables, and a few other items. I hoping that I will be able to get the solid OOP background that I need from JAVA since I hear through the grapevine that it may be a new tool that we will be looking at to enhance our programming. I was looking at PERL but even the PERL programmers we have agree that JAVA is more scalable.

  • Server behaviours are old school!

    "Server behaviours are old school!" was a comment made to me earlier today which has been playing on my mind!
    Am I doing things the old way now? Since Adobe has removed the database panels, perhaps I am! I often see Adobe doing things that I consider to be commercial suicide, but it often turns out to be a move that is well thought out because the industry is moving in the direction applicable to an Adobe decision... or perhaps Adobe making the decision has forced the industry to move with them...
    Should I be doing things differently to future proof myself? If so, how?
    Mat

    This is an ignorant answer. Server behaviors are not a code style, they are (used to be?) a DW mechanism to write repetitive code faster. The code Server behaviors output today is "old school", Server behaviors are a brilliant DW feature and so many DW users do not understand Adobe's decision to dump them instead of updating them...
    Regards,
    Xavier
    MyDreamweaverExtensions.com

  • I am looking to update to a new imac with intel core processor. I am still old school with a powerbook G4. I want to know if I am going to have to upgrade all graphic programs right away after buying new computer. Thanks.

    I am looking to update to a new imac with intel core processor. I am still old school with a powerbook G4:)
    I want to know if I am going to have to upgrade all graphic programs right away after buying new computer.
    Trying to weigh ALL costs involved.
    Thanks for any advice!!!

    Anything you have that is powerpc code only will not run on a new machine.  OS X 10.8 has no support for powerpc code (universal binary programs should be fine).
    Other than that warning, without knowing exactly what programs you have, and what version you are on, it is hard to say whay will or will not migrate alright.
    you might need to do some web searching and check apps at sites like roaringapps or on the programs Company web site.
    http://roaringapps.com/apps:table

  • Trying to load illustrator 6cs onto new mac and the old activation code for my ill cs doesn't work with it

    Trying to load a downloaded version of illustrator 6cs onto new mac and the old activation code for my illustrator cs doesn't work with it.  Do I need a new code or am I missing something?  Same goes for my Photoshop cs.

    you need your serial number.
    if you purchased from or registered with adobe check your account, https://www.adobe.com/account.html

  • HT4623 My old school iPod touch won't update.  Does apple mess it's customers over by not allowing updates for older models of the touch?  My last update is Ios5.  My touch says its up to date.  So has my old school touch reached its pinnacle?

    My old school iPod touch won't update.  Does apple mess it's customers over by not allowing updates for older models of the touch?  My last update is Ios5.  My touch says its up to date.  So has my old school touch reached its pinnacle?

    Correct. The 3G iPod does not have the hardware to support an iOS version higher than 5.1.1
    To more easily find compatible apps:
    iOSSearch - search the iTunes store for compatible apps.
    Apple Club - filter apps by iOS version.
    Starting when iOS 7 was releases, Apple now allows downloading the last compatible version of some apps (iOS 4.2.1 and later only)
    App Store: Downloading Older Versions of Apps on iOS - Apple Club
    App Store: Install the latest compatible version of an app
    You first have to download the non-compatible version on your computer. Then when you try to purchase the version on your iPod you will be offered a compatible version if one exists.

  • Where can I get an old-school style keyboard (one that CLICKS)

    I cannot stand the soft keyboard that came with my Mac Pro and I want to go old school and get a keyboard that gives a loud CLICK every time you press a key, one that you actually feel when the key is depressed. Any suggestions?

    rwiker wrote:
    Somebody else suggested a NOS/refurbished IBM Model M from clickykeyboard.com. These would have to be used with and USB/PS2 adapter, which is actually a bit problematic, as you may have a bit of trouble getting one that works well. A bigger problem is that those keyboards do not have a key that is recognized as Apple/Command, which means that they are, in fact, useless for a Mac Pro
    Instead, you could go to Unicomp (http://www.pckeyboard.com), who manufacture new keyboards based on the Model M mechanism. You should select a version with Windows keys and USB interface - I have 4 Customizer 105 keyboards which I'm completely happy with. Well, apart from the Windows symbols on two of the keys... I'd much prefer to have Apple or Clover symbols.
    Then, once you have the keyboard, you need to get a keyboard mapping for it, unless you want to place stickers conforming to the Apple layout on top of some of the keys If you want to create a new keyboard mapping yourself, you should look for a program named "Ukelele" (http://www.sil.org/computIng/catalog/show_software.asp?id=94).
    I really appreciate your help. Is it really that complicated just to get a keyboard that clicks? I am not a computer person. I went to that Ukelele site and I have no idea what keyboard mapping is nor how to do it.
    As for Tony0074, the one I have is white in the clear casing that ships with new Mac Pros.

  • Mapping new product code from source system to old product code in Oracle COA

    Mapping new product code from source system to old product code in Oracle COA
    Here is the situation:
    One of our legal entities is changing their product codes in their COA segment. We are not changing the code structure in the global SOB. Is there a workaround to pull the source system information into ADI (or any other tool) and map it to the current Oracle product code?
    Thanks and regards,
    [email protected]

    Only The  Data of Your Code will Change
    then if you are trying to copy a standarad sap-code , you need to copy
    every include, FM
    there is a Copy option over there in program
    you can do tat
    thnkx bhanu

  • Danger of using old tax code in purchase order

    Materials management, Finance and controlling modules are active in
    system.we have created new tax codes at the end of Dec 2007 in system
    as per the legal requirement.Also condition types are maintianed with
    validity period. We have updated existing purchase orders (which are
    going to be continued in year 2008) with new tax codes.
    But now if by mistake while creating purchase order, user picks up old
    tax code and saves PO, system does not give any error.
    Is there any way by which we can restrict using of old tax codes at the
    time of creating / changing Purchase orders?
    Thank you for your time.

    hi,
    check the same in FTXP,limit the validity period of the old tax to 2007 only.

  • Problem with Premiere Pro and Old School X3100

    Hi everyone,
    Got a problem here and really looking for help .  I know the intel 965 or X3100 chipset/GPU (in a Dell inspiron 1720 running Win 7 64 bit) is way old school, but as we're waiting for a couple of i7/i5 laptop upgrades, this is what I have to resort to for some minor mobile SD editing (nothing extreme but 15-30s short commercials). With the current Intel driver (8.15.10.1930), the preview monitors (source and sequence) do not work.  They're simply a blank frame (even after I render the sequence).  It seems to be the Intel drivers whooping my butt as there is no problems with the standard W7 WDDM 1.1 display driver, except the computer isn't stable with freezes on wake (and no OpenGL support in PS... which isn't a big deal).  I've also tried Vista 64 drivers in compatibility mode with no luck.
    The rest of the CS4 suite works great.  It is not the trial version and I've tried PP 4.0, 4.01, 4.1, 4.2, 4.2.1 (suggested by another post), and reinstallation.  I've also tried changing settings in the Intel drivers and... even modded 965 drivers.
    I know the X3100 is quite common (maybe not among PP users...) so any experience you might have would be awesome.  Maybe an older Intel driver?  If you can help me, I'll name my laptop after you!  ...unless you realize that could actually be an insult   Thanks!

    This hardware sub-forum is a good place to read about what will run CS5
    While HD editing (which I won't do) will require a RAID for data, what I am going to build for SD editing with CS5 and Win7 64bit is listed near the top of my notes page http://www.pacifier.com/~jtsmith/ADOBE.HTM
    If you are adept with tools... build your own and save $$

  • How do i reinstall my Quicktime Pro from a crashed hard drive. I have my old Pro code

    My HD crashed. I have my old Pro code from my purchase, but I can only download the free version and there is no place I can find to put in my registration code. I also cannot find a Pro Download without going thru another purchase.
    Thanks
    Kerry

    Download and install QuickTime 7 for Windows from http://www.apple.com/quicktime/.
    Once it's installed, click on Start > Control Panel and search for QuickTime.
    Open the QuickTime Control Panel and you should be able to enter your QuickTime Pro registration information there.
    Hope that helps, have a great day.

  • New/Old School Party Mix

    This playlist is a cross generational musical journey that young & old can enjoy. It include new school, with a old school twist. It's a party for all ages. Everybody say, "Watch Me".Playlist

    Sounds like it's an iMac 233 with a tray cd drive. The flashing ? means it's have problems finding a system to boot from which could be software or hardware related. Macs won't boot from usb drives. You may need to swap out the cd drive. Having done it on a 233 I can tell you it's easy.

  • HT4623 I can't find software update on my general tab. ***?? It's an iPad...like the very first old school one. Remember those? Lol

    I can't find software update on my general tab. ***?? It's an iPad...like the very first old school one. Remember those? Lol

    See
    iOS 5: Updating your device to iOS 5
    http://support.apple.com/kb/HT4972
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    If you are currently running an iOS lower than 5.0, connect to your computer & click on the "Update your device using iTunes".
    Tip - You may need to disable your firewall and anitvirus software temporarily.  Then download and install the iOS update. After you update to iOS 5.x, the next update can be installed via wifi (i.e., not connected to your computer).
     Cheers, Tom

  • I can hardly believe my old school Palm Pre was much friendlier than the IPhone.  I have had it for more than six months and still cannot sync my Outlook calendars and contacts.  I get a message like, "no calendar application  identified."    help!

    My old school palm pre was much friendlier than the IPHONE 3G.  I was able to sync my outlook calendars and contacts via wi-fi effortlessly.  I tunes did sync once or twice in the six months that I have had it, but more often it acts like it is syncing and ultimately delivers a message like "no calendar application is supported".  Why the back and forth.  Very frustrating after literally hours of trying to sync my phone with my Outlook calendar and contacts.  HELP!!!!

    What version of MS Office do you have installed? Have you tried re-installing office over top of itself? It may not be properly registered with the OS.

  • Need old-school iCal alerts back in 10.8

    Help! I need the old-school, movable, multi-option snoozable alerts back for my Calendar events. I need to be able to choose how long the snooze interval is like we used to be able to do with iCal alerts - I would sometimes use the smaller increments, but I used the 2 hour snooze all the time and I'm missing it dearly. Also, I miss being able to move the alert off to the side out of the way if I wanted to keep it on screen instead of dismissing it.
    I use Calendar to alert me when it's time for everything from my son's homework, to when to start cooking dinner, to giving my daughter her various meds, and I need more flexibiltiy than Notification Center seems to give.
    With Notification Center, I can't control how long the snooze is, and the default is almost always way too brief an interval. And if I just want to set it aside without closing or snoozing, I can't - it hovers in just about the worst possible spot on my main monitor blocking whatever I happen to be working on.
    This is my only problem with Mountain Lion, but I use Calendar so much it's a pretty bad one.

    I followed the instructions in the link.  point 5 sates:
    If you haven't previously accepted your bundled iLife applications within the Mac App Store, you should see your iLife applications appear in the Accept portion of the screen. Click Accept.
    and I have not.  but this is all I see:
    no iLife option.
    what could be wrong?  My machine came with 10.8.4 installed

Maybe you are looking for

  • Oracle Text in installing Oracle 10g without licence!!

    Hi. Everyone. I've read some thread , but I am still confused about "oracle text". Now, I am testing oracle10g database. I downloaded 10g software from www.oracle.com, and installed it sucessfully on windows xp. When I was trying to import a dump fil

  • Macbook pro 17 dispaly black spots

    have a glossy screen 17 inch mb pro. In the middle of the screen some light grey black spots have appeared. they seem to be under the screen but over the underlying image etc. has anyone else had this problem??

  • If a video is in high definition, does it take up more space than it would in standard definition

    I have freed enough space to hold a standard definition version of the series that I want to buy, but I wanted to get the high defintion version, so I was wondering wether there is any difference.

  • Changing sample rates for recorded audio?

    I've been trying to record VO through premiere. I'm using an m-audio mobile pre which has never given me trouble in any other application. When i turn on Meter Input(s) Only from the panel menu of the track mixer i can clearly see the input move in t

  • Error log for fm hr_infotype_operation

    Hi all . I am using the function module 'HR_INFOTYPE_OPERATION to update an infotype. Its working fine but suppose if some other user has already opend the employee for which the record is being updated - or the employee is locked, the FM do not retu