Sorry for the double post, but when I tried to add the new most recent version of the GameWindow class, it told me I exceeded the character limit. So:
Here is the most recent version of the gameWindow class. (It won't work with the old other classes, but it is the real brains of the program)
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.image.ImageObserver;
import java.util.ArrayList;
import javax.swing.*;
@SuppressWarnings("serial")
public class GameWindow extends JPanel implements Runnable{
GameBooter gameBooter;
private volatile boolean running;
boolean gameIsOver;
boolean clicked;
boolean leftPressed;
boolean rightPressed;
boolean readyToClose;
Snowball snowball;
volatile ArrayList<Obstacle> obstacles;
volatile ArrayList<Obstacle> obstaclesToBeRemoved;
JFrame window;
JPanel gamePanel;
JLabel upgradePointsLabel;
JLabel sizeLabel;
JLabel gameOverLabel;
Font mediumFont;
JButton playButton;
JButton upgradeButton;
JButton achievementsButton;
JButton closeButton;
PlayListener playListener;
UpgradesListener upgradeListener;
AchievementsListener achievementsListener;
CloseListener closeListener;
BorderLayout layout;
Box buttonBox;
Box upgradeInfoBox;
Box upgradesBox;
Box upgradeStatusBox;
Box upgradeLabelBox;
Box pricesBox;
Box achievementInfoBox;
Box achievementStatusBox;
int upgradePoints;
int bestSize;
JButton multiplierButton;
JButton startSizeButton;
JButton backButton;
JButton backButton2;
JLabel multiplierStatusLabel;
JLabel startSizeStatusLabel;
JLabel multiplierCostLabel;
JLabel startSizeCostLabel;
JLabel spacerLabel1;
JLabel spacerLabel2;
JLabel spacerLabel3;
private double upgradeMultiplier;
private int startingSize;
int upgradedTimesOfMultiplier;
int upgradedTimesOfStartingSize;
ArrayList<Boolean> achievementArray;
boolean over500 = false;
boolean over1000 = false;
boolean over5000 = false;
boolean over10000 = false;
boolean allUpgrades = false;
boolean points$10000 = false;
boolean points$100000 = false;
boolean points$1000000 = false;
private Graphics dbg;
private Image dbImage = null;
private static final int PWIDTH = 600;
private static final int PHEIGHT = 600;
KeyHandler keyHandler;
int timesHit = 0;
ImageObserver observer;
public GameWindow(GameBooter booter){
gameBooter = booter;
window = new JFrame("Snowball");
//window.pack();
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.getContentPane().add(this);
window.setSize(600,600);
window.setVisible(true);
window.setResizable(false);
//this.setFocusable(true);
//this.requestFocus();
//window.setFocusable(true);
//window.requestFocus();
layout = new BorderLayout();
this.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
buttonBox = new Box(BoxLayout.X_AXIS);
playButton = new JButton("Play!");
upgradeButton = new JButton("Upgrades");
achievementsButton = new JButton("Achievements");
closeButton = new JButton("Close");
playButton.setFocusable(false);
upgradeButton.setFocusable(false);
achievementsButton.setFocusable(false);
closeButton.setFocusable(false);
backButton = new JButton("Back");
backButton.addActionListener(new BackButtonListener());
backButton2 = new JButton("Back");
backButton2.addActionListener(new BackButton2Listener());
playListener = new PlayListener();
upgradeListener = new UpgradesListener();
achievementsListener = new AchievementsListener();
closeListener = new CloseListener();
playButton.addActionListener(playListener);
upgradeButton.addActionListener(upgradeListener);
achievementsButton.addActionListener(achievementsListener);
closeButton.addActionListener(closeListener);
upgradePointsLabel = new JLabel(" Upgrade Points: " + upgradePoints);
sizeLabel = new JLabel(" Best Size: " + upgradePoints);
Font bigFont = new Font("serif", Font.BOLD, 32);
gameOverLabel = new JLabel(" Game Over");
gameOverLabel.setFont(bigFont);
startingSize = 100;
upgradeMultiplier = 1;
upgradedTimesOfMultiplier = 0;
upgradedTimesOfStartingSize = 0;
upgradesBox = new Box(BoxLayout.Y_AXIS);
upgradeStatusBox = new Box(BoxLayout.X_AXIS);
upgradeLabelBox = new Box(BoxLayout.Y_AXIS);
pricesBox = new Box(BoxLayout.Y_AXIS);
upgradeInfoBox = new Box(BoxLayout.X_AXIS);
achievementInfoBox = new Box(BoxLayout.X_AXIS);
achievementStatusBox = new Box(BoxLayout.Y_AXIS);
multiplierButton = new JButton("Upgrade Points Multiplier");
startSizeButton = new JButton("Starting Size");
multiplierButton.addActionListener(new UpgradedMultiplierButtonListener());
startSizeButton.addActionListener(new UpgradedStartingSizeButtonListener());
mediumFont = new Font("serif", Font.PLAIN, 18);
multiplierStatusLabel = new JLabel(upgradedTimesOfMultiplier + " out of 5");
startSizeStatusLabel = new JLabel(upgradedTimesOfStartingSize + " out of 5");
multiplierCostLabel = new JLabel();
startSizeCostLabel = new JLabel();
spacerLabel1 = new JLabel("Upgrades ");
spacerLabel2 = new JLabel("Status ");
spacerLabel3 = new JLabel("Price ");
multiplierStatusLabel.setFont(mediumFont);
startSizeStatusLabel.setFont(mediumFont);
multiplierCostLabel.setFont(mediumFont);
startSizeCostLabel.setFont(mediumFont);
spacerLabel1.setFont(mediumFont);
spacerLabel2.setFont(mediumFont);
spacerLabel3.setFont(mediumFont);
upgradesBox.add(spacerLabel1);
upgradesBox.add(multiplierButton);
upgradesBox.add(startSizeButton);
pricesBox.add(spacerLabel3);
pricesBox.add(multiplierCostLabel);
pricesBox.add(startSizeCostLabel);
upgradeLabelBox.add(spacerLabel2);
upgradeLabelBox.add(multiplierStatusLabel);
upgradeLabelBox.add(startSizeStatusLabel);
upgradeStatusBox.add(upgradesBox);
upgradeStatusBox.add(pricesBox);
upgradeStatusBox.add(upgradeLabelBox);
buttonBox.add(playButton);
buttonBox.add(upgradeButton);
buttonBox.add(achievementsButton);
buttonBox.add(closeButton);
buttonBox.add(upgradePointsLabel);
buttonBox.add(sizeLabel);
//this.add(BorderLayout.NORTH, buttonBox);
window.getContentPane().add(BorderLayout.NORTH, buttonBox);
//setFocusable(true);
//requestFocus();
clicked = false;
keyHandler = new KeyHandler();
//window.addKeyListener(keyHandler);
//window.setFocusable(true);
//window.requestFocus();
this.addKeyListener(keyHandler);
this.setFocusable(true);
this.requestFocusInWindow();
requestFocus();
achievementArray = new ArrayList<Boolean>();
achievementArray.add(over500);
achievementArray.add(over1000);
achievementArray.add(over5000);
achievementArray.add(over10000);
achievementArray.add(allUpgrades);
achievementArray.add(points$10000);
achievementArray.add(points$100000);
achievementArray.add(points$1000000);
window.validate();
}
public void newRun(){
window.getContentPane().remove(buttonBox);
window.getContentPane().add(this);
window.validate();
obstacles = new ArrayList<Obstacle>();
obstaclesToBeRemoved = new ArrayList<Obstacle>();
snowball = null;
snowball = new Snowball(startingSize);
gameIsOver = false;
run();
}
public void run(){
int period = 20;
long beforeTime, timeDiff, sleepTime;
beforeTime = System.currentTimeMillis();
running = true;
while (running){
gameUpdate();
gameRender();
paintScreen();
if (leftPressed){
leftArrowKeyPressed();
}
if (rightPressed){
rightArrowKeyPressed();
}
if (readyToClose){
gameOver();
}
timeDiff = System.currentTimeMillis() - beforeTime;
sleepTime = period - timeDiff;
if (sleepTime <= 0){
sleepTime = 5;
}
try{
Thread.sleep(sleepTime);
}catch (InterruptedException ex){}
beforeTime = System.currentTimeMillis();
if (gameIsOver){
gameOver();
}
}
} //End of run()
public void gameUpdate(){
snowball.size += 0.25;
snowball.speed = snowball.size / 1000;
snowball.diameter = snowball.size / 10;
snowball.upgradePoints += 0.25 * (upgradeMultiplier) * (snowball.speed);
//snowball.hPos = snowball.hPos + snowball.hMomentum;
for (Obstacle o: obstacles){
o.calculateSize();
if (o.vPos + (0.5 * o.getHeight()) + snowball.diameter > 500){
if ((Math.abs(o.hPos) - (0.5 * o.getWidth())) - snowball.diameter < 0){
if (snowball.size > o.size){
//System.out.println(snowball.size);
snowball.size += 0.5 * (o.size);
//System.out.println("Eaten" + snowball.size);
obstaclesToBeRemoved.add(o);
} else {
gameIsOver = true;
}
}
}
o.vPos += 5 * snowball.speed;
o.hPos += snowball.hMomentum;
if (o.hPos < 0){
o.hPos -= 0.1;
} if (o.hPos > 0){
o.hPos += 0.1;
}
if (o.vPos > 700){
obstaclesToBeRemoved.add(o);
}
}
//System.out.println(obstaclesToBeRemoved.size());
//System.out.println(obstacles.size());
for (Obstacle o:obstaclesToBeRemoved){
obstacles.remove(o);
}
//obstacles.removeAll(obstaclesToBeRemoved);
//System.out.println(obstacles.size());
//int i = 0;
//int repNum = obstaclesToBeRemoved.size();
obstaclesToBeRemoved = null;
obstaclesToBeRemoved = new ArrayList<Obstacle>();
//System.out.println(obstaclesToBeRemoved.size());
if (snowball.hMomentum > 0){
snowball.hMomentum -= 0.01;
}
if (snowball.hMomentum < 0){
snowball.hMomentum += 0.01;
}
genObstacle();
} // End of gameUpdate
private void gameRender(){
if (dbImage == null){
dbImage = createImage(PWIDTH, PHEIGHT);
if (dbImage == null){
System.out.println("dbImage is null");
return;
} else {
dbg= dbImage.getGraphics();
}
}
//clear screen
dbg.setColor(Color.white);
dbg.fillRect(0, 0, PWIDTH, PHEIGHT);
//draw snowball
int xBounds = (int) (300 - (0.5 * snowball.diameter));
int yBounds = (int) (500 - (0.5 * snowball.diameter));
dbg.setColor(Color.white);
dbg.fillOval(xBounds, yBounds, (int) snowball.diameter, (int) snowball.diameter);
dbg.setColor(Color.black);
dbg.drawOval(xBounds, yBounds, (int) snowball.diameter, (int) snowball.diameter);
//draw labels
dbg.drawString((String)("Size: " + (int)(snowball.size)), 25, 25);
dbg.drawString((String)("Upgrade Points: " + (int) (snowball.upgradePoints)), 100, 25);
// draw obstacles
for (Obstacle o: obstacles){
/*-
if (o.isBoulder){
dbg.setColor(Color.gray);
icon = new ImageIcon("Boulder.png").getImage();
//icon.getScaledInstance(newWidth, newHeight, Image.SCALE_DEFAULT);
} if (o.isHouse){
dbg.setColor(Color.PINK);
} if (o.isRock){
dbg.setColor(Color.black);
} if (o.isSnowman){
dbg.setColor(Color.orange);
} if (o.isTree){
dbg.setColor(Color.green);
}
//int obstacleSize = (int) (2.5 * o.diameter);
//double sizeFactor = o.vPos / 100;
//obstacleSize = (int) (100 * (sizeFactor / obstacleSize));
int obstacleSize = (int) (o.vPos / (2.5 * o.diameter));
dbg.fillOval((int) ((300 - o.hPos) - o.diameter), (int) (o.vPos - o.diameter), obstacleSize, obstacleSize);
//dbg.drawImage(icon, (int) ((300 - o.hPos) - o.diameter), (int) (o.vPos - o.diameter));
int dx1 = (int) (o.hPos - (0.5 * o.getWidth()));
int dy1 = (int) (o.vPos + (0.5 * o.getHeight()));
int dx2 = (int) (o.hPos + (0.5 * o.getWidth()));;
int dy2 = (int) (o.vPos - (0.5 * o.getHeight()));
int sx1 = (int) (o.baseWidth - (0.5 * o.baseWidth));
int sy1 = (int) (o.baseHeight + (0.5 * o.baseHeight));
int sx2 = (int) (o.baseWidth + (0.5 * o.baseWidth));;
int sy2 = (int) (o.baseHeight - (0.5 * o.baseHeight));
dbg.drawImage(o.getImage(), dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, Color.black, observer);
**/
dbg.drawImage(o.getScaledImage(), (int) (o.hPos + 1 - (0.5 * o.getWidth())),
(int) (o.vPos + 1 + (0.5 * o.getHeight())), observer);
}
} // End of gameRender
private void paintScreen(){
Graphics g;
try {
g = this.getGraphics();
if ((g != null) && (dbImage != null)){
g.drawImage(dbImage, 0, 0, null);
}
Toolkit.getDefaultToolkit().sync();
g.dispose();
} catch (Exception e){
System.out.println("Graphics context error" + e);
}
}
public void rightArrowKeyPressed(){
snowball.hMomentum += 8 / snowball.size;
System.out.println("Right");
}
public void leftArrowKeyPressed(){
snowball.hMomentum -= 8 / snowball.size;
System.out.println("Left");
}
public void gameOver(){
running = false;
obstacles = null;
obstaclesToBeRemoved = null;
upgradePoints += snowball.upgradePoints;
if (snowball.size > bestSize){
bestSize = (int) snowball.size;
}
if (over500 = false){
if (bestSize > 500){
over500 = true;
upgradePoints += 500;
}
}
if (over1000 = false){
if (bestSize > 1000){
over1000 = true;
upgradePoints += 1000;
}
}
if (over5000 = false){
if (bestSize > 5000){
over5000 = true;
upgradePoints += 5000;
}
}
if (over10000 = false){
if (bestSize > 10000){
over10000 = true;
upgradePoints += 10000;
}
}
if (points$10000 = false){
if (upgradePoints > 9999){
points$10000 = true;
upgradePoints += 1000;
}
}
if (points$100000 = false){
if (upgradePoints > 99999){
points$100000 = true;
upgradePoints += 10000;
}
}
if (points$1000000 = false){
if (upgradePoints > 999999){
points$1000000 = true;
upgradePoints += 100000;
}
}
upgradePointsLabel.setText(" Upgrade Points: " + upgradePoints);
sizeLabel.setText(" Best Size: " + bestSize);
playButton.addActionListener(playListener);
upgradeButton.addActionListener(upgradeListener);
window.getContentPane().add(BorderLayout.NORTH, buttonBox);
window.getContentPane().remove(this);
window.getContentPane().add(BorderLayout.CENTER, gameOverLabel);
window.validate();
}
public void PaintComponent(Graphics g){
super.paintComponent(g);
if (dbImage == null){
g.drawImage(dbImage, 0, 0, null);
}
}
public void genObstacle(){
int randPos;
int randNum = (int) (Math.random() * 50);
int randFactor = (int) (Math.random() * 10);
if (randFactor > 5){
randPos = (int) (Math.random() * 500);
} else {
randPos = (int) (Math.random() * -500);
}
Obstacle newObstacle;
if (randNum == 1){
newObstacle = new Tree();
newObstacle.hPos = randPos;
obstacles.add(newObstacle);
} else if (randNum == 2){
newObstacle = new Boulder();
newObstacle.hPos = randPos;
obstacles.add(newObstacle);
} else if (randNum == 3){
newObstacle = new House();
newObstacle.hPos = randPos;
obstacles.add(newObstacle);
} else if (randNum == 4){
newObstacle = new Rock();
newObstacle.hPos = randPos;
obstacles.add(newObstacle);
} else if (randNum == 5){
newObstacle = new Snowman();
newObstacle.hPos = randPos;
obstacles.add(newObstacle);
}
newObstacle = null;
}
public void setCosts(){
if (upgradedTimesOfMultiplier == 0){
multiplierCostLabel.setText("500");
}
if (upgradedTimesOfMultiplier == 1){
multiplierCostLabel.setText("1000");
}
if (upgradedTimesOfMultiplier == 2){
multiplierCostLabel.setText("2500");
}
if (upgradedTimesOfMultiplier == 3){
multiplierCostLabel.setText("5000");
}
if (upgradedTimesOfMultiplier == 4){
multiplierCostLabel.setText("25000");
}
if (upgradedTimesOfMultiplier == 5){
multiplierCostLabel.setText("-");
}
if (upgradedTimesOfStartingSize == 0){
startSizeCostLabel.setText("500");
}
if (upgradedTimesOfStartingSize == 1){
startSizeCostLabel.setText("1000");
}
if (upgradedTimesOfStartingSize == 2){
startSizeCostLabel.setText("2500");
}
if (upgradedTimesOfStartingSize == 3){
startSizeCostLabel.setText("5000");
}
if (upgradedTimesOfStartingSize == 4){
startSizeCostLabel.setText("25000");
}
if (upgradedTimesOfStartingSize == 5){
startSizeCostLabel.setText("-");
}
startSizeStatusLabel.setText(upgradedTimesOfStartingSize + " out of 5");
multiplierStatusLabel.setText(upgradedTimesOfMultiplier + " out of 5");
}
public void upgradesScreen(){
window.getContentPane().remove(buttonBox);
setCosts();
upgradeInfoBox.add(backButton);
upgradeInfoBox.add(upgradePointsLabel);
window.getContentPane().add(BorderLayout.NORTH, upgradeInfoBox);
//window.getContentPane().add(BorderLayout.CENTER, pricesBox);
//window.getContentPane().add(BorderLayout.WEST, upgradesBox);
window.getContentPane().add(BorderLayout.WEST, upgradeStatusBox);
window.validate();
}
public void achievementsScreen(){
window.getContentPane().remove(buttonBox);
JLabel title = new JLabel("Achievements");
title.setFont(new Font("serif", Font.BOLD, 32));
achievementStatusBox.add(title);
achievementInfoBox.add(backButton2);
JLabel over500Label = new JLabel("Over 500 in size");
JLabel over1000Label = new JLabel("Over 1,000 in size");
JLabel over5000Label = new JLabel("Over 5,000 in size");
JLabel over10000Label = new JLabel("Over 10,000 in size");
JLabel points$10000Label = new JLabel("Over 10,000 upgrade points");
JLabel points$100000Label = new JLabel("Over 100,000 upgrade points");
JLabel points$1000000Label = new JLabel("Over 1,000,000 upgrade points");
JLabel allUpgradesLabel = new JLabel("All upgrades purchased");
ArrayList<JLabel> achievementLabelList = new ArrayList<JLabel>();
achievementLabelList.add(over500Label);
achievementLabelList.add(over1000Label);
achievementLabelList.add(over5000Label);
achievementLabelList.add(over10000Label);
achievementLabelList.add(points$10000Label);
achievementLabelList.add(points$100000Label);
achievementLabelList.add(points$1000000Label);
achievementLabelList.add(allUpgradesLabel);
Font italic = new Font("serif", Font.ITALIC, 16);
Font gotten = new Font("serif", Font.BOLD, 16);
for (JLabel label: achievementLabelList){
label.setFont(gotten);
}
if (!over500){
over500Label.setFont(italic);
}
if (!over1000){
over1000Label.setFont(italic);
}
if (!over5000){
over5000Label.setFont(italic);
}
if (!over10000){
over10000Label.setFont(italic);
}
if (!points$10000){
points$10000Label.setFont(italic);
}
if (!points$100000){
points$100000Label.setFont(italic);
}
if (!points$1000000){
points$1000000Label.setFont(italic);
}
if (!allUpgrades){
allUpgradesLabel.setFont(italic);
}
for (JLabel label: achievementLabelList){
achievementStatusBox.add(label);
}
window.getContentPane().add(BorderLayout.NORTH, achievementInfoBox);
window.getContentPane().add(BorderLayout.WEST, achievementStatusBox);
window.validate();
}
public class KeyHandler extends KeyAdapter{
public void keyTyped(KeyEvent e){
int keyCode = e.getKeyCode();
if((keyCode == KeyEvent.VK_ESCAPE) || (keyCode == KeyEvent.VK_Q) ||
(keyCode == KeyEvent.VK_END) ){
readyToClose = true;
}
}
public void keyPressed(KeyEvent e){
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_LEFT){
leftPressed = true;
System.out.println("left");
}
else if (keyCode == KeyEvent.VK_RIGHT){
rightPressed = true;
System.out.println("Right");
}
}
public void keyReleased(KeyEvent e){
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_LEFT){
leftPressed = false;
//System.out.println("left");
}
else if (keyCode == KeyEvent.VK_RIGHT){
rightPressed = false;
//System.out.println("Right");
}
}
}
public class PlayListener implements ActionListener{
public void actionPerformed(ActionEvent event){
//notPaused = true;
if (!clicked){
//System.out.println(" New game ");
newRun();
clicked = true;
} else {
clicked = false;
}
}
}
public class UpgradesListener implements ActionListener{
public void actionPerformed(ActionEvent event){
upgradesScreen();
}
}
public class AchievementsListener implements ActionListener{
public void actionPerformed(ActionEvent event){
achievementsScreen();
}
}
public class CloseListener implements ActionListener{
public void actionPerformed(ActionEvent event){
System.exit(0);
}
}
public class BackButtonListener implements ActionListener{
public void actionPerformed(ActionEvent event){
window.getContentPane().remove(upgradeInfoBox);
window.getContentPane().remove(upgradeStatusBox);
buttonBox.add(upgradePointsLabel);
window.getContentPane().add(BorderLayout.NORTH, buttonBox);
window.validate();
}
}
public class BackButton2Listener implements ActionListener{
public void actionPerformed(ActionEvent event){
achievementStatusBox.removeAll();
window.getContentPane().remove(achievementInfoBox);
window.getContentPane().remove(achievementStatusBox);
buttonBox.add(upgradePointsLabel);
window.getContentPane().add(BorderLayout.NORTH, buttonBox);
window.validate();
}
}
public class UpgradedMultiplierButtonListener implements ActionListener{
public void actionPerformed(ActionEvent event){
if (upgradedTimesOfMultiplier == 0){
if (upgradePoints > 500){
upgradePoints -= 500;
upgradedTimesOfMultiplier += 1;
upgradeMultiplier = 1.1;
}
} else if (upgradedTimesOfMultiplier == 1){
if (upgradePoints > 1000){
upgradePoints -= 1000;
upgradedTimesOfMultiplier += 1;
upgradeMultiplier = 1.2;
}
} else if (upgradedTimesOfMultiplier == 2){
if (upgradePoints > 2500){
upgradePoints -= 2500;
upgradedTimesOfMultiplier += 1;
upgradeMultiplier = 1.3;
}
} else if (upgradedTimesOfMultiplier == 3){
if (upgradePoints > 5000){
upgradePoints -= 5000;
upgradedTimesOfMultiplier += 1;
upgradeMultiplier = 1.4;
}
} else if (upgradedTimesOfMultiplier == 4){
if (upgradePoints > 25000){
upgradePoints -= 25000;
upgradedTimesOfMultiplier += 1;
upgradeMultiplier = 1.75;
}
}
setCosts();
upgradePointsLabel.setText(" Upgrade Points: " + upgradePoints);
}
}
public class UpgradedStartingSizeButtonListener implements ActionListener{
public void actionPerformed(ActionEvent event){
if (upgradedTimesOfStartingSize == 0){
if (upgradePoints > 500){
upgradePoints -= 500;
upgradedTimesOfStartingSize += 1;
startingSize = 150;
}
} else if (upgradedTimesOfStartingSize == 1){
if (upgradePoints > 1000){
upgradePoints -= 1000;
upgradedTimesOfStartingSize += 1;
startingSize = 200;
}
} else if (upgradedTimesOfStartingSize == 2){
if (upgradePoints > 2500){
upgradePoints -= 2500;
upgradedTimesOfStartingSize += 1;
startingSize = 250;
}
} else if (upgradedTimesOfStartingSize == 3){
if (upgradePoints > 5000){
upgradePoints -= 5000;
upgradedTimesOfStartingSize += 1;
startingSize = 300;
}
} else if (upgradedTimesOfStartingSize == 4){
if (upgradePoints > 25000){
upgradePoints -= 25000;
upgradedTimesOfStartingSize += 1;
startingSize = 400;
}
}
setCosts();
upgradePointsLabel.setText(" Upgrade Points: " + upgradePoints);
}
}
public class RunnerThread extends Thread{
public RunnerThread(){
//System.out.println("Borgle");
newRun();
}
}
} // End of gameWindow Class