mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 11:39:45 +02:00
Opponent von Player extended und drei Gegner hinzugefügt.
This commit is contained in:
@@ -27,11 +27,14 @@ public class GameLoopD extends JFrame implements Runnable {
|
|||||||
private static JPanel statusPanel;
|
private static JPanel statusPanel;
|
||||||
private static JPanel gamePanel;
|
private static JPanel gamePanel;
|
||||||
private static JPanel actionPanel;
|
private static JPanel actionPanel;
|
||||||
|
|
||||||
public static Player player01;
|
|
||||||
public static KeyBindings kb;
|
public static KeyBindings kb;
|
||||||
|
|
||||||
DynamicObject dynO3;
|
public static Player player01;
|
||||||
|
|
||||||
|
public static Opponent opponent01;
|
||||||
|
public static Opponent opponent02;
|
||||||
|
public static Opponent opponent03;
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
@@ -73,29 +76,26 @@ public class GameLoopD extends JFrame implements Runnable {
|
|||||||
frame.pack();
|
frame.pack();
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
||||||
/*
|
|
||||||
* zeug aus dem alten gameloop
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
DynamicObject dynO1 = new DynamicObject();
|
|
||||||
gamePanel.add(dynO1);
|
|
||||||
DynamicObject dynO2 = new DynamicObject();
|
|
||||||
gamePanel.add(dynO2);
|
|
||||||
DynamicObject dynO3 = new DynamicObject();
|
|
||||||
gamePanel.add(dynO3);
|
|
||||||
DynamicObject dynO4 = new DynamicObject();
|
|
||||||
gamePanel.add(dynO4);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
player01 = new Player();
|
player01 = new Player();
|
||||||
// Query.setPlayer(player01);
|
// Query.setPlayer(player01);
|
||||||
gamePanel.add(player01);
|
gamePanel.add(player01);
|
||||||
player01.setBounds(25, 25, 200, 200); // !!! MUSS DRIN BLEIBEN TROTZ NACHTRÄGLICHES SPAWN UMSETZEN !!!
|
player01.setBounds(25,25,25, 25); // !!! MUSS DRIN BLEIBEN TROTZ NACHTRÄGLICHES SPAWN UMSETZEN !!!
|
||||||
|
|
||||||
|
// Gegner hinzufügen
|
||||||
|
opponent01 = new Opponent();
|
||||||
|
gamePanel.add(opponent01);
|
||||||
|
opponent01.setBounds(50,50,25,25);
|
||||||
|
|
||||||
|
opponent02 = new Opponent();
|
||||||
|
gamePanel.add(opponent02);
|
||||||
|
opponent02.setBounds(50,50,25,25);
|
||||||
|
|
||||||
|
opponent03 = new Opponent();
|
||||||
|
gamePanel.add(opponent03);
|
||||||
|
opponent03.setBounds(50,50,25,25);
|
||||||
|
|
||||||
|
|
||||||
gamePanel.setFocusable(true);
|
gamePanel.setFocusable(true);
|
||||||
|
|
||||||
kb = new KeyBindings(player01);
|
kb = new KeyBindings(player01);
|
||||||
gamePanel.addKeyListener(kb);
|
gamePanel.addKeyListener(kb);
|
||||||
|
|
||||||
@@ -107,6 +107,13 @@ public class GameLoopD extends JFrame implements Runnable {
|
|||||||
Point spawnPoint = SpawnAssistant.getPathLocationOnGrid();
|
Point spawnPoint = SpawnAssistant.getPathLocationOnGrid();
|
||||||
player01.spawnAt(spawnPoint);
|
player01.spawnAt(spawnPoint);
|
||||||
|
|
||||||
|
Point spawnPoint2 = SpawnAssistant.getPathLocationOnGrid();
|
||||||
|
opponent01.spawnAt(spawnPoint2);
|
||||||
|
Point spawnPoint3 = SpawnAssistant.getPathLocationOnGrid();
|
||||||
|
opponent02.spawnAt(spawnPoint3);
|
||||||
|
Point spawnPoint4 = SpawnAssistant.getPathLocationOnGrid();
|
||||||
|
opponent03.spawnAt(spawnPoint4);
|
||||||
|
|
||||||
gamePanel.setVisible(true);
|
gamePanel.setVisible(true);
|
||||||
|
|
||||||
//GameInterface.getGamePanel().repaint();
|
//GameInterface.getGamePanel().repaint();
|
||||||
@@ -193,6 +200,9 @@ public class GameLoopD extends JFrame implements Runnable {
|
|||||||
private void tick() {
|
private void tick() {
|
||||||
kb.checkKeyActivity();
|
kb.checkKeyActivity();
|
||||||
player01.tick();
|
player01.tick();
|
||||||
|
opponent01.tick();
|
||||||
|
opponent02.tick();
|
||||||
|
opponent03.tick();
|
||||||
|
|
||||||
}
|
}
|
||||||
// alles was animiert wird hier rein (paints)
|
// alles was animiert wird hier rein (paints)
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package de.heatup.testing;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import de.heatup.mapengine.MapGrid;
|
||||||
|
|
||||||
|
public class Opponent extends Player {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private boolean redecide = true; // Nötig sobald der Schritt in die gewollte Richtung erfolgt ist
|
||||||
|
private Random rand = new Random();
|
||||||
|
private int testX;
|
||||||
|
private int testY;
|
||||||
|
// Notwendig um Blockade zu erkennen
|
||||||
|
private int previ;
|
||||||
|
private char prevd;
|
||||||
|
private int prevX;
|
||||||
|
private int prevY;
|
||||||
|
private boolean blocked = false;
|
||||||
|
private int blockedCounter = 0;
|
||||||
|
|
||||||
|
@Override protected void loadBufferedImage() {
|
||||||
|
try {
|
||||||
|
super.bf1 = ImageIO.read(new File("src/de/heatup/resources/images/little_green_guy_verysmall.png"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void tick() {
|
||||||
|
|
||||||
|
if ( redecide ) {
|
||||||
|
while ( true ) {
|
||||||
|
|
||||||
|
this.d = (rand.nextInt(10) <= 4) ? 'x' : 'y';
|
||||||
|
this.i = (rand.nextInt(10) <= 4) ? 1 : -1;
|
||||||
|
|
||||||
|
// Sicher stellen das man nicht in die Richtung aus der man gekommen ist.
|
||||||
|
if ( redecide && this.d == this.prevd && this.i != this.previ ) {
|
||||||
|
this.i *= -1;
|
||||||
|
}
|
||||||
|
// Blockade Erkennung
|
||||||
|
if ( this.prevX == this.getGridLocation().x & this.prevY == this.getGridLocation().y ) {
|
||||||
|
this.blockedCounter++;
|
||||||
|
} else {
|
||||||
|
this.blockedCounter = 0;
|
||||||
|
}
|
||||||
|
this.blocked = (this.blockedCounter >= 30) ? true : false;
|
||||||
|
this.prevX = this.getGridLocation().x;
|
||||||
|
this.prevY = this.getGridLocation().y;
|
||||||
|
// Blockade Erkennung
|
||||||
|
|
||||||
|
// Blockade auflösen, gehe doch in die Richtung aus man gekommen ist
|
||||||
|
if ( this.blocked ) {
|
||||||
|
System.out.println("Warning: Block detected!");
|
||||||
|
this.i *= -1;
|
||||||
|
this.blocked = false;
|
||||||
|
this.blockedCounter = 0;
|
||||||
|
}
|
||||||
|
// Blockade auflösen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (d == 'x') {
|
||||||
|
testX=this.getGridLocation().x + i;
|
||||||
|
testY=this.getGridLocation().y;
|
||||||
|
} else if (d == 'y') {
|
||||||
|
testY=this.getGridLocation().y + i;
|
||||||
|
testX=this.getGridLocation().x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MapGrid.getGridCell(testX,testY).isPath()) {
|
||||||
|
this.setGridLocation(testX, testY);
|
||||||
|
this.prevd = d;
|
||||||
|
this.previ = i;
|
||||||
|
redecide = false;
|
||||||
|
animate = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( animate ) {
|
||||||
|
int newx = this.getX();
|
||||||
|
int newy = this.getY();
|
||||||
|
|
||||||
|
for (int s = 0; s<2; s++) { // speed multiplikator
|
||||||
|
if (d == 'x' && i == -1) {
|
||||||
|
newx = newx - 1;
|
||||||
|
} else if (d == 'x' && i == 1) {
|
||||||
|
newx = newx + 1;
|
||||||
|
} else if (d == 'y' && i == -1) {
|
||||||
|
newy = newy - 1;
|
||||||
|
} else if (d == 'y' && i == 1) {
|
||||||
|
newy = newy + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setAutoBounds(newx, newy);
|
||||||
|
stepCounter--;
|
||||||
|
if ( stepCounter <= 0 ) {
|
||||||
|
animate = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stepCounter <= 0) {
|
||||||
|
stepCounter = 25;
|
||||||
|
redecide = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,27 +13,19 @@ import javax.swing.JComponent;
|
|||||||
|
|
||||||
public class Player extends JComponent {
|
public class Player extends JComponent {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
// private Image image;
|
protected BufferedImage bf1;
|
||||||
private BufferedImage bf1;
|
protected Graphics2D g2d;
|
||||||
private Graphics2D g2d;
|
|
||||||
|
|
||||||
private double rescaleFactorX = 0.0;
|
private double rescaleFactorX = 0.0;
|
||||||
private double rescaleFactorY = 0.0;
|
private double rescaleFactorY = 0.0;
|
||||||
|
|
||||||
public boolean startMove = false;
|
public boolean startMove = false;
|
||||||
public boolean animate = false;
|
public boolean animate = false;
|
||||||
|
protected char d;
|
||||||
private char d;
|
protected int i;
|
||||||
private int i;
|
|
||||||
|
|
||||||
final int stepx = 25;
|
final int stepx = 25;
|
||||||
final int stepy = 25;
|
final int stepy = 25;
|
||||||
|
|
||||||
int startX;
|
int startX;
|
||||||
int startY;
|
int startY;
|
||||||
|
int stepCounter = 25;
|
||||||
int currentCountX = 25;
|
|
||||||
|
|
||||||
private Point currentGridPosition;
|
private Point currentGridPosition;
|
||||||
|
|
||||||
public void setGridLocation(int x, int y) {
|
public void setGridLocation(int x, int y) {
|
||||||
@@ -46,14 +38,11 @@ public class Player extends JComponent {
|
|||||||
|
|
||||||
public void paintComponent(Graphics g) {
|
public void paintComponent(Graphics g) {
|
||||||
g2d = (Graphics2D) g;
|
g2d = (Graphics2D) g;
|
||||||
// this.image =
|
|
||||||
// Toolkit.getDefaultToolkit().getImage("src/de/heatup/resources/images/little_green_guy.png");
|
|
||||||
if (bf1 == null) {
|
if (bf1 == null) {
|
||||||
loadBufferedImage();
|
loadBufferedImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
g2d.drawImage(bf1, 0, 0, this);
|
g2d.drawImage(bf1, 0, 0, this);
|
||||||
g2d.setStroke(new BasicStroke(8.0f));
|
g2d.setStroke(new BasicStroke(8.0f));
|
||||||
g2d.finalize();
|
g2d.finalize();
|
||||||
@@ -64,11 +53,10 @@ public class Player extends JComponent {
|
|||||||
this.setAutoBounds(spawnPoint.x*25, spawnPoint.y*25);
|
this.setAutoBounds(spawnPoint.x*25, spawnPoint.y*25);
|
||||||
this.repaint();
|
this.repaint();
|
||||||
}
|
}
|
||||||
private void loadBufferedImage() {
|
|
||||||
|
protected void loadBufferedImage() {
|
||||||
try {
|
try {
|
||||||
this.bf1 = ImageIO
|
this.bf1 = ImageIO.read(new File("src/de/heatup/resources/images/little_blue_guy_verysmall.png"));
|
||||||
.read(new File(
|
|
||||||
"src/de/heatup/resources/images/little_blue_guy_verysmall.png"));
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -88,15 +76,10 @@ public class Player extends JComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void tick() {
|
public void tick() {
|
||||||
|
|
||||||
if ( startMove || animate ) {
|
if ( startMove || animate ) {
|
||||||
|
|
||||||
int newx = this.getX();
|
int newx = this.getX();
|
||||||
int newy = this.getY();
|
int newy = this.getY();
|
||||||
|
|
||||||
for (int s = 0; s<2; s++) { // speed multiplikator
|
for (int s = 0; s<2; s++) { // speed multiplikator
|
||||||
|
|
||||||
|
|
||||||
if (d == 'x' && i == -1) {
|
if (d == 'x' && i == -1) {
|
||||||
newx = newx - 1;
|
newx = newx - 1;
|
||||||
} else if (d == 'x' && i == 1) {
|
} else if (d == 'x' && i == 1) {
|
||||||
@@ -106,26 +89,18 @@ public class Player extends JComponent {
|
|||||||
} else if (d == 'y' && i == 1) {
|
} else if (d == 'y' && i == 1) {
|
||||||
newy = newy + 1;
|
newy = newy + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setAutoBounds(newx, newy);
|
this.setAutoBounds(newx, newy);
|
||||||
|
stepCounter--;
|
||||||
|
if ( stepCounter <= 0 ) {
|
||||||
currentCountX--;
|
|
||||||
|
|
||||||
if ( currentCountX <= 0 ) {
|
|
||||||
animate = false;
|
animate = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentCountX <= 0) {
|
if (stepCounter <= 0) {
|
||||||
currentCountX = 25;
|
stepCounter = 25;
|
||||||
|
|
||||||
//debug
|
//debug
|
||||||
System.out.println("on grid - x: "+getGridLocation().x + " y: "+getGridLocation().y);
|
System.out.println("on grid - x: "+getGridLocation().x + " y: "+getGridLocation().y);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
startMove = false;
|
startMove = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,129 +1,129 @@
|
|||||||
package de.heatup.ui;
|
//package de.heatup.ui;
|
||||||
import java.awt.BorderLayout;
|
//import java.awt.BorderLayout;
|
||||||
import java.awt.Dimension;
|
//import java.awt.Dimension;
|
||||||
import java.awt.DisplayMode;
|
//import java.awt.DisplayMode;
|
||||||
import java.awt.EventQueue;
|
//import java.awt.EventQueue;
|
||||||
import java.awt.Frame;
|
//import java.awt.Frame;
|
||||||
import java.awt.GraphicsDevice;
|
//import java.awt.GraphicsDevice;
|
||||||
import java.awt.GraphicsEnvironment;
|
//import java.awt.GraphicsEnvironment;
|
||||||
import java.awt.GridLayout;
|
//import java.awt.GridLayout;
|
||||||
import java.awt.Point;
|
//import java.awt.Point;
|
||||||
import java.awt.Toolkit;
|
//import java.awt.Toolkit;
|
||||||
import java.awt.Window;
|
//import java.awt.Window;
|
||||||
import java.io.IOException;
|
//import java.io.IOException;
|
||||||
|
//
|
||||||
import javax.swing.BorderFactory;
|
//import javax.swing.BorderFactory;
|
||||||
import javax.swing.JFrame;
|
//import javax.swing.JFrame;
|
||||||
import javax.swing.JLabel;
|
//import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
//import javax.swing.JPanel;
|
||||||
import javax.swing.UIManager;
|
//import javax.swing.UIManager;
|
||||||
import javax.swing.UnsupportedLookAndFeelException;
|
//import javax.swing.UnsupportedLookAndFeelException;
|
||||||
|
//
|
||||||
import de.heatup.mapengine.MapEngine;
|
//import de.heatup.mapengine.MapEngine;
|
||||||
import de.heatup.objects.DynamicObject;
|
//import de.heatup.objects.DynamicObject;
|
||||||
import de.heatup.objects.StaticObject;
|
//import de.heatup.objects.StaticObject;
|
||||||
import de.heatup.objects.logic;
|
//import de.heatup.objects.logic;
|
||||||
import de.heatup.testing.GameLoop;
|
//import de.heatup.testing.GameLoop;
|
||||||
|
//
|
||||||
|
//
|
||||||
public class GameInterface extends JFrame {
|
//public class GameInterface extends JFrame {
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
*
|
// *
|
||||||
*/
|
// */
|
||||||
private static final long serialVersionUID = 1L;
|
// private static final long serialVersionUID = 1L;
|
||||||
private static JPanel outerPanel;
|
// private static JPanel outerPanel;
|
||||||
private static JPanel statusPanel;
|
// private static JPanel statusPanel;
|
||||||
private static JPanel gamePanel;
|
// private static JPanel gamePanel;
|
||||||
private static JPanel actionPanel;
|
// private static JPanel actionPanel;
|
||||||
//private BufferedImage image;
|
// //private BufferedImage image;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
public static void createGUI() {
|
// public static void createGUI() {
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// // TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
final JFrame frame = new JFrame();
|
// final JFrame frame = new JFrame();
|
||||||
|
//
|
||||||
// Fullscreen testing: Remember not to use pack() when using fullscreen mode
|
//// Fullscreen testing: Remember not to use pack() when using fullscreen mode
|
||||||
// frame.setUndecorated(true);
|
//// frame.setUndecorated(true);
|
||||||
// frame.setResizable(false);
|
//// frame.setResizable(false);
|
||||||
// frame.setExtendedState(Frame.MAXIMIZED_BOTH);
|
//// frame.setExtendedState(Frame.MAXIMIZED_BOTH);
|
||||||
// frame.validate();
|
//// frame.validate();
|
||||||
// GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(frame);
|
//// GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(frame);
|
||||||
|
//
|
||||||
frame.setTitle("HeatUP!");
|
// frame.setTitle("HeatUP!");
|
||||||
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
// frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
//frame.setResizable(true);
|
// //frame.setResizable(true);
|
||||||
//frame.createBufferStrategy(2);
|
// //frame.createBufferStrategy(2);
|
||||||
|
//
|
||||||
//Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
// //Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
//frame.setBounds(0,0,screenSize.width, screenSize.height);
|
// //frame.setBounds(0,0,screenSize.width, screenSize.height);
|
||||||
|
//
|
||||||
|
//
|
||||||
outerPanel = new JPanel();
|
// outerPanel = new JPanel();
|
||||||
outerPanel.setLayout(new BorderLayout());
|
// outerPanel.setLayout(new BorderLayout());
|
||||||
//outerPanel.setBorder(BorderFactory.createTitledBorder("outerPanel"));
|
// //outerPanel.setBorder(BorderFactory.createTitledBorder("outerPanel"));
|
||||||
outerPanel.setVisible(true);
|
// outerPanel.setVisible(true);
|
||||||
|
//
|
||||||
statusPanel = new JPanel();
|
// statusPanel = new JPanel();
|
||||||
statusPanel.setLayout(new GridLayout(1,4));
|
// statusPanel.setLayout(new GridLayout(1,4));
|
||||||
statusPanel.setPreferredSize(new Dimension(800,80));
|
// statusPanel.setPreferredSize(new Dimension(800,80));
|
||||||
//statusPanel.setBorder(BorderFactory.createTitledBorder("statusPanel"));
|
// //statusPanel.setBorder(BorderFactory.createTitledBorder("statusPanel"));
|
||||||
|
//
|
||||||
gamePanel = new JPanel();
|
// gamePanel = new JPanel();
|
||||||
gamePanel.setLayout(null);
|
// gamePanel.setLayout(null);
|
||||||
gamePanel.setPreferredSize(new Dimension(800,600));
|
// gamePanel.setPreferredSize(new Dimension(800,600));
|
||||||
gamePanel.setVisible(true);
|
// gamePanel.setVisible(true);
|
||||||
//gamePanel.setBorder(BorderFactory.createTitledBorder("gamePanel"));
|
// //gamePanel.setBorder(BorderFactory.createTitledBorder("gamePanel"));
|
||||||
|
//
|
||||||
actionPanel = new JPanel();
|
// actionPanel = new JPanel();
|
||||||
actionPanel.setLayout(new GridLayout(1,1));
|
// actionPanel.setLayout(new GridLayout(1,1));
|
||||||
//actionPanel.setBorder(BorderFactory.createTitledBorder("actionPanel"));
|
// //actionPanel.setBorder(BorderFactory.createTitledBorder("actionPanel"));
|
||||||
actionPanel.setPreferredSize(new Dimension(800,80));
|
// actionPanel.setPreferredSize(new Dimension(800,80));
|
||||||
|
//
|
||||||
|
//
|
||||||
outerPanel.add(statusPanel,BorderLayout.NORTH);
|
// outerPanel.add(statusPanel,BorderLayout.NORTH);
|
||||||
outerPanel.add(gamePanel,BorderLayout.CENTER);
|
// outerPanel.add(gamePanel,BorderLayout.CENTER);
|
||||||
outerPanel.add(actionPanel,BorderLayout.SOUTH);
|
// outerPanel.add(actionPanel,BorderLayout.SOUTH);
|
||||||
|
//
|
||||||
frame.add(outerPanel);
|
// frame.add(outerPanel);
|
||||||
// Comment out for fullscreen
|
// // Comment out for fullscreen
|
||||||
frame.pack();
|
// frame.pack();
|
||||||
frame.setVisible(true);
|
// frame.setVisible(true);
|
||||||
frame.repaint();
|
// frame.repaint();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* We need to use EQ for EDT
|
// * We need to use EQ for EDT
|
||||||
*
|
// *
|
||||||
* TODO: add fullscreen mode
|
// * TODO: add fullscreen mode
|
||||||
*/
|
// */
|
||||||
public static void main(String[] args) throws IOException, InterruptedException {
|
// public static void main(String[] args) throws IOException, InterruptedException {
|
||||||
|
//
|
||||||
EventQueue.invokeLater(new Runnable() {
|
// EventQueue.invokeLater(new Runnable() {
|
||||||
@Override
|
// @Override
|
||||||
public void run() {
|
// public void run() {
|
||||||
// GameInterface is static now.
|
// // GameInterface is static now.
|
||||||
//GameInterface gameWindow = new GameInterface();
|
// //GameInterface gameWindow = new GameInterface();
|
||||||
GameInterface.createGUI();
|
// GameInterface.createGUI();
|
||||||
|
//
|
||||||
// Start game loop to add player, opponents, maps and everything you need
|
// // Start game loop to add player, opponents, maps and everything you need
|
||||||
GameLoop.startGameLoop();
|
// GameLoop.startGameLoop();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public static JPanel getGamePanel() {
|
// public static JPanel getGamePanel() {
|
||||||
return gamePanel;
|
// return gamePanel;
|
||||||
}
|
// }
|
||||||
public static JPanel getStatusPanel() {
|
// public static JPanel getStatusPanel() {
|
||||||
return statusPanel;
|
// return statusPanel;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
Reference in New Issue
Block a user