This commit is contained in:
iryupnik 2020-04-06 14:32:16 +02:00
parent 00c34e649d
commit 99f9e80246
7 changed files with 68 additions and 10 deletions

View File

@ -4,11 +4,12 @@ import ruscz.game.gameOfProd.Windows.WindowOfMenu;
import javax.swing.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowEvent;
public class Game extends JFrame {
public static final int WINDOW_WIDTH = 11;
public static final int WINDOW_HEIGHT = 11;
private static final int WINDOW_WIDTH = 11;
private static final int WINDOW_HEIGHT = 11;
public static final int CELL_SIZE = 50;
private static final int KEY_FULLSCREEN = 115;
@ -26,11 +27,11 @@ public class Game extends JFrame {
menu = new WindowOfMenu(this, freeMove);
//tohle spustí na začátku menu, ale nejsem schopen přinutit to menu, aby se vzdalo Listeneru a mohl ho využít Game
//add(menu);
add(menu);
//tohle spustí na začátku hru, vše funguje tak, jak má
add(freeMove);
freeMove.start(true);
// add(freeMove);
// freeMove.start(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setUndecorated(true);
@ -53,7 +54,6 @@ public class Game extends JFrame {
setExtendedState(NORMAL);
else
setExtendedState(MAXIMIZED_BOTH);
return;
}
else {

View File

@ -120,7 +120,6 @@ public class WindowOfFreeMove extends JLayeredPane {
}
public void start(boolean newGame) {
mapLinkedList = new LinkedList<>();
mapManager = new MapManager(mapLinkedList, canvas, this);

View File

@ -26,6 +26,7 @@ public class WindowOfMenu extends JLayeredPane {
background.setBackground(Color.BLACK);
startNewGame = new JButton("START NEW GAME");
startNewGame.setFocusable(false);
startNewGame.setBounds((WINDOW_WIDTH*CELL_SIZE - 200) / 2,(WINDOW_HEIGHT*CELL_SIZE - 30) / 2 -70,200,30);
startNewGame.setActionCommand("startNewGame");
startNewGame.addActionListener(new ActionListener() {
@ -33,11 +34,13 @@ public class WindowOfMenu extends JLayeredPane {
public void actionPerformed(ActionEvent actionEvent) {
cleanUp();
game.add(freeMove);
freeMove.setFocusable(true);
freeMove.start(true);
}
});
loadSavedGame = new JButton("LOAD SAVED GAME");
loadSavedGame.setFocusable(false);
loadSavedGame.setBounds((WINDOW_WIDTH*CELL_SIZE - 200) / 2,(WINDOW_HEIGHT*CELL_SIZE - 30) / 2,200,30);
loadSavedGame.setActionCommand("loadSavedGame");
loadSavedGame.addActionListener(new ActionListener() {
@ -45,11 +48,13 @@ public class WindowOfMenu extends JLayeredPane {
public void actionPerformed(ActionEvent actionEvent) {
cleanUp();
game.add(freeMove);
freeMove.setFocusable(true);
freeMove.start(false);
}
});
exitGame = new JButton("EXIT GAME");
exitGame.setFocusable(false);
exitGame.setBounds((WINDOW_WIDTH*CELL_SIZE - 200) / 2,(WINDOW_HEIGHT*CELL_SIZE - 30) / 2 + 70,200,30);
exitGame.setActionCommand("exitGame");
exitGame.addActionListener(new ActionListener() {
@ -68,9 +73,6 @@ public class WindowOfMenu extends JLayeredPane {
private void cleanUp() {
setVisible(false);
game.remove(this);
// startNewGame.removeAll();
// loadSavedGame.removeAll();
// exitGame.removeAll();
}
public WindowOfMenu menu() { return this; }

View File

@ -0,0 +1,50 @@
<map>
<mapName>m1</mapName>
<events>
</events>
</map>
<map>
<mapName>m2</mapName>
<events>
<event>
<x>7</x>
<y>2</y>
<active>true</active>
</event>
</events>
</map>
<map>
<mapName>m3</mapName>
<events>
<event>
<x>2</x>
<y>5</y>
<active>true</active>
</event>
</events>
</map>
<map>
<mapName>m4</mapName>
<events>
<event>
<x>3</x>
<y>3</y>
<active>true</active>
</event>
</events>
</map>
<map>
<mapName>m5</mapName>
<events>
</events>
</map>
<map>
<mapName>m6</mapName>
<events>
<event>
<x>11</x>
<y>11</y>
<active>true</active>
</event>
</events>
</map>

View File

@ -0,0 +1 @@
TODO: Inventory

View File

@ -0,0 +1,5 @@
<location>
<map>m6</map>
<x>11</x>
<y>1</y>
</location>

View File

@ -0,0 +1 @@
TODO: Village