Skip to content

Commit

Permalink
Document stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Arinerron committed Mar 31, 2017
1 parent 3c6987f commit 0f0ba0d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ public class Game extends JPanel {

public static void main(String[] args) {
if(args.length != 0 && (args[0].equalsIgnoreCase("--tileeditor") || args[0].equalsIgnoreCase("-e")))
tileeditor.Main.main(args);
tileeditor.Main.main(args); // they want the tileeditor
else
new Game(args);
new Game(args); // start the game
}

// initialization with arguments
Expand Down Expand Up @@ -151,6 +151,7 @@ public Game(String[] args) {

// initialization
public Game() {
// init tileset and map
try {
this.tile_null = getImage("tiles/null");
this.character_spritesheet = getImage("character_spritesheet");
Expand All @@ -163,6 +164,7 @@ public Game() {
System.exit(1);
}

// setup jframe
this.frame = new JFrame("Game");
this.frame.setBackground(Color.BLACK);
this.setBackground(Color.BLACK);
Expand All @@ -173,6 +175,7 @@ public Game() {
this.frame.getContentPane().add(this);
this.frame.pack();

// event listeners
KeyListener listener = new KeyListener() {
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_W) {
Expand Down Expand Up @@ -338,11 +341,14 @@ public void componentMoved(ComponentEvent e) {}
this.setFocusable(true);
this.requestFocus();

// setup tick timer
new java.util.Timer().scheduleAtFixedRate(new java.util.TimerTask() { // yup, I had to specify the class
public void run() {
if(running) {
// tick the game dev off ;)
tick();

// do particle stuff, and calculate speed
new Thread(new Runnable() {@Override public void run() {
BufferedImage particles_front = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
BufferedImage particles_back = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Expand Down

0 comments on commit 0f0ba0d

Please sign in to comment.