diff --git a/classes/artifacts/gameOfProd_jar/gameOfProd.jar b/classes/artifacts/gameOfProd_jar/gameOfProd.jar
new file mode 100644
index 0000000..fe1b24a
Binary files /dev/null and b/classes/artifacts/gameOfProd_jar/gameOfProd.jar differ
diff --git a/gameOfProd.iml b/gameOfProd.iml
index 597cd8e..e1c1adc 100644
--- a/gameOfProd.iml
+++ b/gameOfProd.iml
@@ -6,9 +6,18 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index a8b1c6e..7bf1359 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,4 +18,12 @@
+
+
+ org.junit.jupiter
+ junit-jupiter
+ RELEASE
+ test
+
+
\ No newline at end of file
diff --git a/src/main/java/ruscz/game/gameOfProd/Game.java b/src/main/java/ruscz/game/gameOfProd/Game.java
index 568c7b5..a036209 100644
--- a/src/main/java/ruscz/game/gameOfProd/Game.java
+++ b/src/main/java/ruscz/game/gameOfProd/Game.java
@@ -41,7 +41,7 @@ public class Game extends JFrame {
battle = new WindowOfBattle(this);
//tohle spustí na začátku menu
-// add(menu);
+ add(menu);
//tohle spustí na začátku hru
// add(freeMove);
@@ -52,7 +52,7 @@ public class Game extends JFrame {
// battle.startBattle();
//Tohle spustí na začátku tileset overview
- new LevelEditor();
+ //new LevelEditor();
setDefaultCloseOperation(EXIT_ON_CLOSE);
setUndecorated(true);
diff --git a/src/main/java/ruscz/game/gameOfProd/Image/ImageCell.java b/src/main/java/ruscz/game/gameOfProd/Image/ImageCell.java
index d6cc2a9..00f6463 100644
--- a/src/main/java/ruscz/game/gameOfProd/Image/ImageCell.java
+++ b/src/main/java/ruscz/game/gameOfProd/Image/ImageCell.java
@@ -30,7 +30,7 @@ public class ImageCell {
try {
mapBackground = new int[WindowOfFreeMove.CANVAS_WIDTH][WindowOfFreeMove.CANVAS_HEIGHT];
mapForeground = new int[WindowOfFreeMove.CANVAS_WIDTH][WindowOfFreeMove.CANVAS_HEIGHT];
- File mapFile = new File("src/main/resources/maps/" + WindowOfFreeMove.CHAPTER + "/" + name + "-tileset.txt");
+ File mapFile = new File("src/main/resources/maps/" + WindowOfFreeMove.getCHAPTER() + "/" + name + "-tileset.txt");
Scanner scanner = new Scanner(mapFile);
int j = 0;
while (scanner.hasNextLine()) {
@@ -96,7 +96,7 @@ public class ImageCell {
public void imageObjectset(String file) {
try {
- File objectFile = new File("src/main/resources/maps/" + WindowOfFreeMove.CHAPTER + "/" + file + "-objectset.txt");
+ File objectFile = new File("src/main/resources/maps/" + WindowOfFreeMove.getCHAPTER() + "/" + file + "-objectset.txt");
Scanner scanner = new Scanner(objectFile);
int j = 0;
while (scanner.hasNextLine()) {
diff --git a/src/main/java/ruscz/game/gameOfProd/Map/Map.java b/src/main/java/ruscz/game/gameOfProd/Map/Map.java
index a4454d7..9792b09 100644
--- a/src/main/java/ruscz/game/gameOfProd/Map/Map.java
+++ b/src/main/java/ruscz/game/gameOfProd/Map/Map.java
@@ -58,7 +58,7 @@ public class Map {
public static Map loadMapFromFile(String name, WindowOfFreeMove window) {
try {
- File file = new File("src/main/resources/maps/" + WindowOfFreeMove.CHAPTER + "/" + name + ".txt");
+ File file = new File("src/main/resources/maps/" + WindowOfFreeMove.getCHAPTER() + "/" + name + ".txt");
scanner = new Scanner(file);
String firstLine = scanner.nextLine();
String[] size = firstLine.split(" ");
@@ -139,7 +139,7 @@ public class Map {
public void linkMaps(Map map, WindowOfFreeMove window) {
try {
- File dialogFile = new File("src/main/resources/maps/" + WindowOfFreeMove.CHAPTER + "/" + map.getName() + ".txt");
+ File dialogFile = new File("src/main/resources/maps/" + WindowOfFreeMove.getCHAPTER() + "/" + map.getName() + ".txt");
scanner = new Scanner(dialogFile);
String firstLine = scanner.nextLine();
String[] size = firstLine.split(" ");
diff --git a/src/main/java/ruscz/game/gameOfProd/Save/LoadManager.java b/src/main/java/ruscz/game/gameOfProd/Save/LoadManager.java
index 4df16e9..e8f262e 100644
--- a/src/main/java/ruscz/game/gameOfProd/Save/LoadManager.java
+++ b/src/main/java/ruscz/game/gameOfProd/Save/LoadManager.java
@@ -73,7 +73,7 @@ public class LoadManager {
while (scanner.hasNextLine()) {
String[] mapName = scanner.nextLine().split(" ");
- if (mapName[0].equals("<" + WindowOfFreeMove.CHAPTER + ">")) {
+ if (mapName[0].equals("<" + WindowOfFreeMove.getCHAPTER() + ">")) {
Map map = Map.loadMapFromFile(mapName[1], window);
if (mapName[1].equals("tutorial")) map.getPerson().setImagePerson("tutorialpers", rec);
else map.getPerson().setImagePerson("main", rec);
@@ -96,7 +96,7 @@ public class LoadManager {
Scanner scanner = new Scanner(npcsFile);
while (scanner.hasNextLine()) {
String[] npcName = scanner.nextLine().split(" ");
- if (npcName[0].equals("<" + WindowOfFreeMove.CHAPTER + ">")) {
+ if (npcName[0].equals("<" + WindowOfFreeMove.getCHAPTER() + ">")) {
File npcFile = new File("src/main/resources/characters/" + npcName[1] + ".txt");
Scanner sc = new Scanner(npcFile);
String[] position = sc.nextLine().split(" ");
diff --git a/src/main/java/ruscz/game/gameOfProd/Sounds/SoundManager.java b/src/main/java/ruscz/game/gameOfProd/Sounds/SoundManager.java
index 276bf36..7291489 100644
--- a/src/main/java/ruscz/game/gameOfProd/Sounds/SoundManager.java
+++ b/src/main/java/ruscz/game/gameOfProd/Sounds/SoundManager.java
@@ -21,7 +21,7 @@ public class SoundManager {
public void loadSoundMap(String file) {
try {
- File mapFile = new File("src/main/resources/maps/" + WindowOfFreeMove.CHAPTER + "/" + file + "-tileset.txt");
+ File mapFile = new File("src/main/resources/maps/" + WindowOfFreeMove.getCHAPTER() + "/" + file + "-tileset.txt");
Scanner scanner = new Scanner(mapFile);
soundMap = new HashMap<>();
while (scanner.hasNextLine()) {
diff --git a/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java b/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java
index 7de5fdd..ae4f4c2 100644
--- a/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java
+++ b/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java
@@ -35,7 +35,15 @@ public class WindowOfFreeMove extends JLayeredPane {
private static final int KEY_ESCAPE = 27;
- public static int CHAPTER = 0;
+ public static String getCHAPTER() {
+ return CHAPTER;
+ }
+
+ public static void setCHAPTER(String CHAPTER) {
+ WindowOfFreeMove.CHAPTER = CHAPTER;
+ }
+
+ private static String CHAPTER = "0";
private JFrame game;
private Canvas canvas;
@@ -190,7 +198,7 @@ public class WindowOfFreeMove extends JLayeredPane {
}
public void loadNextChapter() {
- CHAPTER++;
+ CHAPTER = String.valueOf(Integer.parseInt(CHAPTER) + 1);
isReadyToPaint = false;
mapLinkedList = new LinkedList<>();
mapManager = new MapManager(mapLinkedList, canvas, this);
diff --git a/src/main/resources/maps/unused/m1-cellmap.txt b/src/main/resources/maps/999/m1-cellmap.txt
similarity index 100%
rename from src/main/resources/maps/unused/m1-cellmap.txt
rename to src/main/resources/maps/999/m1-cellmap.txt
diff --git a/src/main/resources/maps/unused/m1-objectset.txt b/src/main/resources/maps/999/m1-objectset.txt
similarity index 100%
rename from src/main/resources/maps/unused/m1-objectset.txt
rename to src/main/resources/maps/999/m1-objectset.txt
diff --git a/src/main/resources/maps/unused/m1-tileset.txt b/src/main/resources/maps/999/m1-tileset.txt
similarity index 100%
rename from src/main/resources/maps/unused/m1-tileset.txt
rename to src/main/resources/maps/999/m1-tileset.txt
diff --git a/src/main/resources/maps/unused/m1.txt b/src/main/resources/maps/999/m1.txt
similarity index 100%
rename from src/main/resources/maps/unused/m1.txt
rename to src/main/resources/maps/999/m1.txt
diff --git a/src/main/resources/maps/unused/m2-cellmap.txt b/src/main/resources/maps/999/m2-cellmap.txt
similarity index 100%
rename from src/main/resources/maps/unused/m2-cellmap.txt
rename to src/main/resources/maps/999/m2-cellmap.txt
diff --git a/src/main/resources/maps/unused/m2-objectset.txt b/src/main/resources/maps/999/m2-objectset.txt
similarity index 100%
rename from src/main/resources/maps/unused/m2-objectset.txt
rename to src/main/resources/maps/999/m2-objectset.txt
diff --git a/src/main/resources/maps/unused/m2-tileset.txt b/src/main/resources/maps/999/m2-tileset.txt
similarity index 100%
rename from src/main/resources/maps/unused/m2-tileset.txt
rename to src/main/resources/maps/999/m2-tileset.txt
diff --git a/src/main/resources/maps/unused/m2.txt b/src/main/resources/maps/999/m2.txt
similarity index 100%
rename from src/main/resources/maps/unused/m2.txt
rename to src/main/resources/maps/999/m2.txt
diff --git a/src/main/resources/maps/unused/m3-cellmap.txt b/src/main/resources/maps/999/m3-cellmap.txt
similarity index 100%
rename from src/main/resources/maps/unused/m3-cellmap.txt
rename to src/main/resources/maps/999/m3-cellmap.txt
diff --git a/src/main/resources/maps/unused/m3-objectset.txt b/src/main/resources/maps/999/m3-objectset.txt
similarity index 100%
rename from src/main/resources/maps/unused/m3-objectset.txt
rename to src/main/resources/maps/999/m3-objectset.txt
diff --git a/src/main/resources/maps/unused/m3-tileset.txt b/src/main/resources/maps/999/m3-tileset.txt
similarity index 100%
rename from src/main/resources/maps/unused/m3-tileset.txt
rename to src/main/resources/maps/999/m3-tileset.txt
diff --git a/src/main/resources/maps/unused/m3.txt b/src/main/resources/maps/999/m3.txt
similarity index 100%
rename from src/main/resources/maps/unused/m3.txt
rename to src/main/resources/maps/999/m3.txt
diff --git a/src/main/resources/maps/unused/m4-cellmap.txt b/src/main/resources/maps/999/m4-cellmap.txt
similarity index 100%
rename from src/main/resources/maps/unused/m4-cellmap.txt
rename to src/main/resources/maps/999/m4-cellmap.txt
diff --git a/src/main/resources/maps/unused/m4-objectset.txt b/src/main/resources/maps/999/m4-objectset.txt
similarity index 100%
rename from src/main/resources/maps/unused/m4-objectset.txt
rename to src/main/resources/maps/999/m4-objectset.txt
diff --git a/src/main/resources/maps/unused/m4-tileset.txt b/src/main/resources/maps/999/m4-tileset.txt
similarity index 100%
rename from src/main/resources/maps/unused/m4-tileset.txt
rename to src/main/resources/maps/999/m4-tileset.txt
diff --git a/src/main/resources/maps/unused/m4.txt b/src/main/resources/maps/999/m4.txt
similarity index 100%
rename from src/main/resources/maps/unused/m4.txt
rename to src/main/resources/maps/999/m4.txt
diff --git a/src/main/resources/maps/unused/m6-cellmap.txt b/src/main/resources/maps/999/m6-cellmap.txt
similarity index 100%
rename from src/main/resources/maps/unused/m6-cellmap.txt
rename to src/main/resources/maps/999/m6-cellmap.txt
diff --git a/src/main/resources/maps/unused/m6-objectset.txt b/src/main/resources/maps/999/m6-objectset.txt
similarity index 100%
rename from src/main/resources/maps/unused/m6-objectset.txt
rename to src/main/resources/maps/999/m6-objectset.txt
diff --git a/src/main/resources/maps/unused/m6-tileset.txt b/src/main/resources/maps/999/m6-tileset.txt
similarity index 100%
rename from src/main/resources/maps/unused/m6-tileset.txt
rename to src/main/resources/maps/999/m6-tileset.txt
diff --git a/src/main/resources/maps/unused/m6.txt b/src/main/resources/maps/999/m6.txt
similarity index 100%
rename from src/main/resources/maps/unused/m6.txt
rename to src/main/resources/maps/999/m6.txt
diff --git a/src/main/resources/save/savedGame/events.txt b/src/main/resources/save/savedGame/events.txt
index a18be6b..e69de29 100644
--- a/src/main/resources/save/savedGame/events.txt
+++ b/src/main/resources/save/savedGame/events.txt
@@ -1,65 +0,0 @@
-
-
-
-
-
diff --git a/src/main/resources/save/savedGame/person.txt b/src/main/resources/save/savedGame/person.txt
index da4d904..e69de29 100644
--- a/src/main/resources/save/savedGame/person.txt
+++ b/src/main/resources/save/savedGame/person.txt
@@ -1,6 +0,0 @@
-
-
- 8
- 16
- 3
-
\ No newline at end of file
diff --git a/src/main/resources/save/savedGame/village.txt b/src/main/resources/save/savedGame/village.txt
index 1b4bc7b..e69de29 100644
--- a/src/main/resources/save/savedGame/village.txt
+++ b/src/main/resources/save/savedGame/village.txt
@@ -1 +0,0 @@
-TODO: Village
\ No newline at end of file
diff --git a/src/test/java/ruscz/game/gameOfProd/Scripts/PathFinderTest.java b/src/test/java/ruscz/game/gameOfProd/Scripts/PathFinderTest.java
new file mode 100644
index 0000000..40f6088
--- /dev/null
+++ b/src/test/java/ruscz/game/gameOfProd/Scripts/PathFinderTest.java
@@ -0,0 +1,47 @@
+package ruscz.game.gameOfProd.Scripts;
+
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import ruscz.game.gameOfProd.Map.Map;
+import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
+
+import javax.swing.*;
+import java.util.stream.Stream;
+
+public class PathFinderTest {
+
+ public static Stream argumentsStream(){
+ return Stream.of(
+ Arguments.of(1,1,1,1)
+// Arguments.of(),
+// Arguments.of(),
+// Arguments.of(),
+// Arguments.of()
+ );
+ }
+
+
+ @ParameterizedTest
+ @MethodSource("argumentsStream")
+ public void getWayWithCollision_usingMap6ForTestOfPathFinding_rightPositionOfNpc(int startX, int startY, int endX, int endY) {
+ //Arrange
+ WindowOfFreeMove freeMove;
+
+ //Act
+ freeMove = new WindowOfFreeMove(new JFrame());
+ freeMove.setVisible(false);
+ WindowOfFreeMove.setCHAPTER("999");
+ freeMove.start(true);
+ freeMove.setMapManager(Map.findMapByName("m6",freeMove));
+
+
+ //Assert
+
+
+
+
+ }
+
+
+}