Skip to content

Commit

Permalink
Release Version 0.9.1-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrekker committed Mar 19, 2018
1 parent 60214f1 commit 0ec3df3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/GameGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ public GameGUI() {
this.addKeyListener(this);
this.add(new GameGraphics());

addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
if(GameTracker.shouldClose) System.exit(0);
}
});

this.setVisible(true);
}

Expand Down
7 changes: 7 additions & 0 deletions src/GameOver.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ public void run() {

add(panel);

addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
if(GameTracker.shouldClose) System.exit(0);
}
});

setVisible(true);
}

Expand Down
1 change: 1 addition & 0 deletions src/GameTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;

public class GameTracker {
public static boolean shouldClose=true;
public static int Score = 0;
private static ArrayList<String> leaderboard = new ArrayList<String>();
private static String name;
Expand Down
2 changes: 2 additions & 0 deletions src/Ship.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ private void doPlayerCollision() {
this.destroy();
GameOver frame = new GameOver();
frame.setVisible(true);
GameTracker.shouldClose=false;
Launcher.gui.dispatchEvent(new WindowEvent(Launcher.gui, WindowEvent.WINDOW_CLOSING));
GameTracker.shouldClose=true;
} else {
GameTracker.killLife();
Player player=Launcher.gui.player;
Expand Down

0 comments on commit 0ec3df3

Please sign in to comment.