diff options
-rw-r--r-- | src/main/java/Actor.java | 1 | ||||
-rw-r--r-- | src/main/java/Subconscious.java | 32 | ||||
-rw-r--r-- | src/main/java/WorldScene.java | 1 |
3 files changed, 18 insertions, 16 deletions
diff --git a/src/main/java/Actor.java b/src/main/java/Actor.java index 7ebdf7f..9f6f5e6 100644 --- a/src/main/java/Actor.java +++ b/src/main/java/Actor.java @@ -9,6 +9,7 @@ public class Actor { public final String name; public final Type type; + protected final int MAXHP; protected int hp; protected int x, y; diff --git a/src/main/java/Subconscious.java b/src/main/java/Subconscious.java index 8fed909..3e66800 100644 --- a/src/main/java/Subconscious.java +++ b/src/main/java/Subconscious.java @@ -52,7 +52,7 @@ public class Subconscious addComponentListener(this); } - public void createWindow() { + private void createWindow() { window = new JFrame(TITLE); window.setSize(new Dimension(800, 600)); window.setMinimumSize(getSize()); @@ -60,11 +60,11 @@ public class Subconscious } /* game logic */ - public void gameLoop() { + private void gameLoop() { } - public void gameRender() { + private void gameRender() { if (dbImage == null) { dbImage = createImage(getWidth(), getHeight()); if (dbImage == null) { @@ -87,6 +87,7 @@ public class Subconscious } /* animator and game thread */ + @Override public void run() { long beforeTime, afterTime, sleepTime; @@ -115,6 +116,7 @@ public class Subconscious beforeTime = System.currentTimeMillis(); } + window.dispose(); System.exit(0); } @@ -130,18 +132,18 @@ public class Subconscious } /* listeners */ - public void mousePressed(MouseEvent e) {} - public void mouseReleased(MouseEvent e) {} - public void mouseEntered(MouseEvent e) {} - public void mouseExited(MouseEvent e) {} - public void mouseClicked(MouseEvent e) { + @Override public void mousePressed(MouseEvent e) {} + @Override public void mouseReleased(MouseEvent e) {} + @Override public void mouseEntered(MouseEvent e) {} + @Override public void mouseExited(MouseEvent e) {} + @Override public void mouseClicked(MouseEvent e) { int x = e.getX(); int y = e.getY(); } - public void keyPressed(KeyEvent e) {} - public void keyTyped(KeyEvent e) {} - public void keyReleased(KeyEvent e) { + @Override public void keyPressed(KeyEvent e) {} + @Override public void keyTyped(KeyEvent e) {} + @Override public void keyReleased(KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_Q && e.isControlDown()) { @@ -149,10 +151,10 @@ public class Subconscious } } - public void componentHidden(ComponentEvent e) {} - public void componentShown(ComponentEvent e) {} - public void componentMoved(ComponentEvent e) {} - public void componentResized(ComponentEvent e) { + @Override public void componentHidden(ComponentEvent e) {} + @Override public void componentShown(ComponentEvent e) {} + @Override public void componentMoved(ComponentEvent e) {} + @Override public void componentResized(ComponentEvent e) { dbImage = null; // create new image with the correct size } diff --git a/src/main/java/WorldScene.java b/src/main/java/WorldScene.java index 99ac291..2145234 100644 --- a/src/main/java/WorldScene.java +++ b/src/main/java/WorldScene.java @@ -8,7 +8,6 @@ import java.awt.Graphics2D; import java.util.ArrayList; - public class WorldScene extends Scene { private ArrayList<Actor> actors = new ArrayList<Actor>(); |