diff --git a/src/main/java/ruscz/game/gameOfProd/Cells/Npc.java b/src/main/java/ruscz/game/gameOfProd/Cells/Npc.java index 966b0b2..140d147 100644 --- a/src/main/java/ruscz/game/gameOfProd/Cells/Npc.java +++ b/src/main/java/ruscz/game/gameOfProd/Cells/Npc.java @@ -78,9 +78,11 @@ public class Npc extends Person { int direction = Integer.parseInt(imageInfo[2]); int offsetX = Integer.parseInt(imageInfo[3]); int offsetY = Integer.parseInt(imageInfo[4]); + int widthCoef = Integer.parseInt(imageInfo[5]); + int heightCoef = Integer.parseInt(imageInfo[6]); image = ImageIO.read(new File("src/main/resources/characters/" + scanner.nextLine())).getSubimage(width * direction, 0, width, height); g.drawImage(image, getX() * getSize() + (getSize() / 5) + offsetX, - getY() * getSize() - (getSize() * 3/5) + offsetY, getSize() * 3/5, getSize() * 3/2, null); + getY() * getSize() - (getSize() * 3/5) + offsetY, getSize() * widthCoef/5, getSize() * heightCoef/2, null); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/ruscz/game/gameOfProd/Cells/Person.java b/src/main/java/ruscz/game/gameOfProd/Cells/Person.java index 0e3aabb..490281e 100644 --- a/src/main/java/ruscz/game/gameOfProd/Cells/Person.java +++ b/src/main/java/ruscz/game/gameOfProd/Cells/Person.java @@ -216,9 +216,11 @@ public class Person extends Cell { } } else { distanceOfAnimation = getSize(); -// g.drawImage(imagePerson.getImagesOfDirection()[directionSight + 4], getX() * getSize(), -// getY() * getSize(), getSize(), getSize(), null); - g.drawImage(imagePerson.getImagesOfDirection()[directionSight + 4], getX() * getSize(), + if (map.getName().equals("tutorial")) + g.drawImage(imagePerson.getImagesOfDirection()[directionSight + 4], getX() * getSize() + (getSize() / 10), + getY() * getSize(), getSize() * 8/10, getSize(), null); + else + g.drawImage(imagePerson.getImagesOfDirection()[directionSight + 4], getX() * getSize(), getY() * getSize() - (getSize() * 3/5), getSize(), getSize() * 3/2, null); } } @@ -240,31 +242,35 @@ public class Person extends Cell { Xsize -= distanceOfAnimation; break; } -// if (distanceOfAnimation > getSize() * 3 / 4) { -// g.drawImage(imagePerson.getImagesOfDirection()[direction], getX() * getSize() + Xsize, -// getY() * getSize() + Ysize, getSize(), getSize(), null); -// } else if (distanceOfAnimation > getSize() / 2) { -// g.drawImage(imagePerson.getImagesOfDirection()[direction + 4], getX() * getSize() + Xsize, -// getY() * getSize() + Ysize, getSize(), getSize(), null); -// } else if (distanceOfAnimation > getSize() / 4) { -// g.drawImage(imagePerson.getImagesOfDirection()[direction + 8], getX() * getSize() + Xsize, -// getY() * getSize() + Ysize, getSize(), getSize(), null); -// } else{ -// g.drawImage(imagePerson.getImagesOfDirection()[direction + 4], getX() * getSize() + Xsize, -// getY() * getSize() + Ysize, getSize(), getSize(), null); -// } - if (distanceOfAnimation > getSize() * 3 / 4) { - g.drawImage(imagePerson.getImagesOfDirection()[direction], getX() * getSize() + Xsize, - getY() * getSize() + Ysize - (getSize() * 3/5), getSize(), getSize() * 3/2, null); - } else if (distanceOfAnimation > getSize() / 2) { - g.drawImage(imagePerson.getImagesOfDirection()[direction + 4], getX() * getSize() + Xsize, - getY() * getSize() + Ysize - (getSize() * 3/5), getSize(), getSize() * 3/2, null); - } else if (distanceOfAnimation > getSize() / 4) { - g.drawImage(imagePerson.getImagesOfDirection()[direction + 8], getX() * getSize() + Xsize, - getY() * getSize() + Ysize - (getSize() * 3/5), getSize(), getSize() * 3/2, null); - } else{ - g.drawImage(imagePerson.getImagesOfDirection()[direction + 4], getX() * getSize() + Xsize, - getY() * getSize() + Ysize - (getSize() * 3/5), getSize(), getSize() * 3/2, null); + if (map.getName().equals("tutorial")) { + if (distanceOfAnimation > getSize() * 3 / 4) { + g.drawImage(imagePerson.getImagesOfDirection()[direction], getX() * getSize() + (getSize() / 10), + getY() * getSize(), getSize() * 8/10, getSize(), null); + } else if (distanceOfAnimation > getSize() / 2) { + g.drawImage(imagePerson.getImagesOfDirection()[direction + 4], getX() * getSize() + (getSize() / 10), + getY() * getSize(), getSize() * 8/10, getSize(), null); + } else if (distanceOfAnimation > getSize() / 4) { + g.drawImage(imagePerson.getImagesOfDirection()[direction + 8], getX() * getSize() + (getSize() / 10), + getY() * getSize(), getSize() * 8/10, getSize(), null); + } else { + g.drawImage(imagePerson.getImagesOfDirection()[direction + 4], getX() * getSize() + (getSize() / 10), + getY() * getSize(), getSize() * 8/10, getSize(), null); + } + } + else { + if (distanceOfAnimation > getSize() * 3 / 4) { + g.drawImage(imagePerson.getImagesOfDirection()[direction], getX() * getSize() + Xsize, + getY() * getSize() + Ysize - (getSize() * 3 / 5), getSize(), getSize() * 3 / 2, null); + } else if (distanceOfAnimation > getSize() / 2) { + g.drawImage(imagePerson.getImagesOfDirection()[direction + 4], getX() * getSize() + Xsize, + getY() * getSize() + Ysize - (getSize() * 3 / 5), getSize(), getSize() * 3 / 2, null); + } else if (distanceOfAnimation > getSize() / 4) { + g.drawImage(imagePerson.getImagesOfDirection()[direction + 8], getX() * getSize() + Xsize, + getY() * getSize() + Ysize - (getSize() * 3 / 5), getSize(), getSize() * 3 / 2, null); + } else { + g.drawImage(imagePerson.getImagesOfDirection()[direction + 4], getX() * getSize() + Xsize, + getY() * getSize() + Ysize - (getSize() * 3 / 5), getSize(), getSize() * 3 / 2, null); + } } } diff --git a/src/main/java/ruscz/game/gameOfProd/Save/LoadManager.java b/src/main/java/ruscz/game/gameOfProd/Save/LoadManager.java index 21ddcd8..5618a9d 100644 --- a/src/main/java/ruscz/game/gameOfProd/Save/LoadManager.java +++ b/src/main/java/ruscz/game/gameOfProd/Save/LoadManager.java @@ -74,7 +74,8 @@ public class LoadManager { while (scanner.hasNextLine()) { String mapName = scanner.nextLine(); Map map = Map.loadMapFromFile(mapName, window); - map.getPerson().setImagePerson("main", rec); + if (mapName.equals("tutorial")) map.getPerson().setImagePerson("tutorialpers", rec); + else map.getPerson().setImagePerson("main", rec); map.setName(mapName); mapLinkedList.add(map); } diff --git a/src/main/resources/characters/boss.txt b/src/main/resources/characters/boss.txt index 95d5ae3..00a841a 100644 --- a/src/main/resources/characters/boss.txt +++ b/src/main/resources/characters/boss.txt @@ -1,3 +1,3 @@ 4 2 boss -50 91 0 0 30 +50 91 0 -10 30 5 3 boss.png \ No newline at end of file diff --git a/src/main/resources/characters/boy1.txt b/src/main/resources/characters/boy1.txt index 2faba78..e7a9746 100644 --- a/src/main/resources/characters/boy1.txt +++ b/src/main/resources/characters/boy1.txt @@ -1,3 +1,3 @@ 17 20 openspace -35 86 1 0 30 +35 86 1 0 30 3 3 boy1.png \ No newline at end of file diff --git a/src/main/resources/characters/boy2.txt b/src/main/resources/characters/boy2.txt index 68b2bdf..451165d 100644 --- a/src/main/resources/characters/boy2.txt +++ b/src/main/resources/characters/boy2.txt @@ -1,3 +1,3 @@ 5 1 openspace -35 86 0 0 0 +35 86 0 0 0 3 3 boy2.png \ No newline at end of file diff --git a/src/main/resources/characters/boy3.txt b/src/main/resources/characters/boy3.txt index 152e1bb..e9efef9 100644 --- a/src/main/resources/characters/boy3.txt +++ b/src/main/resources/characters/boy3.txt @@ -1,3 +1,3 @@ 4 12 openspace -35 84 0 0 0 +35 84 0 0 0 3 3 boy3.png \ No newline at end of file diff --git a/src/main/resources/characters/boy4.txt b/src/main/resources/characters/boy4.txt index fe9a0fb..65636ab 100644 --- a/src/main/resources/characters/boy4.txt +++ b/src/main/resources/characters/boy4.txt @@ -1,3 +1,3 @@ 2 20 openspace -35 84 1 0 30 +35 84 1 0 30 3 3 boy4.png \ No newline at end of file diff --git a/src/main/resources/characters/boy5.txt b/src/main/resources/characters/boy5.txt index c3728ac..b676333 100644 --- a/src/main/resources/characters/boy5.txt +++ b/src/main/resources/characters/boy5.txt @@ -1,3 +1,3 @@ 12 20 openspace -35 86 1 0 30 +35 86 1 0 30 3 3 boy5.png \ No newline at end of file diff --git a/src/main/resources/characters/girl1.txt b/src/main/resources/characters/girl1.txt index 6041400..5ede4ed 100644 --- a/src/main/resources/characters/girl1.txt +++ b/src/main/resources/characters/girl1.txt @@ -1,3 +1,3 @@ 6 1 openspace -35 86 2 0 0 +35 86 2 0 0 3 3 girl1.png \ No newline at end of file diff --git a/src/main/resources/characters/girl2.txt b/src/main/resources/characters/girl2.txt index de7e771..5888aa7 100644 --- a/src/main/resources/characters/girl2.txt +++ b/src/main/resources/characters/girl2.txt @@ -1,3 +1,3 @@ 7 24 openspace -35 86 1 0 30 +35 86 1 0 30 3 3 girl2.png \ No newline at end of file diff --git a/src/main/resources/characters/tutorialpers.txt b/src/main/resources/characters/tutorialpers.txt new file mode 100644 index 0000000..03c151b --- /dev/null +++ b/src/main/resources/characters/tutorialpers.txt @@ -0,0 +1,2 @@ +40 40 +mainpng.png \ No newline at end of file diff --git a/src/main/resources/maps/m1.txt b/src/main/resources/maps/m1.txt index a8acfed..3b1f405 100644 --- a/src/main/resources/maps/m1.txt +++ b/src/main/resources/maps/m1.txt @@ -7,5 +7,5 @@ BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY MOVETO,7,4,openspace BLOCK EMPTY EMPTY INTER,first-dialog EMPTY INTER,dialog-test EMPTY EMPTY EMPTY BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK -BLOCK MOVETO,5,1,m5 EMPTY MOVETO,6,1,m6 EMPTY EMPTY EMPTY EMPTY MOVETO,1,1,m2 BLOCK +BLOCK MOVETO,5,1,tutorial EMPTY MOVETO,6,1,m6 EMPTY EMPTY EMPTY EMPTY MOVETO,1,1,m2 BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK \ No newline at end of file diff --git a/src/main/resources/maps/m5-objectset.txt b/src/main/resources/maps/m5-objectset.txt deleted file mode 100644 index ca48cd3..0000000 --- a/src/main/resources/maps/m5-objectset.txt +++ /dev/null @@ -1,10 +0,0 @@ -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 \ No newline at end of file diff --git a/src/main/resources/maps/m5-tileset.txt b/src/main/resources/maps/m5-tileset.txt deleted file mode 100644 index c8ff195..0000000 --- a/src/main/resources/maps/m5-tileset.txt +++ /dev/null @@ -1,12 +0,0 @@ - A2_Ground.png 512 384 32 - D_OutDoor.png 512 512 32 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 82 94 1 1 82 94 1 1 -1 1 83 95 1 1 83 95 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 153 1 1 1 1 153 1 1 -1 1 153 153 153 153 153 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 diff --git a/src/main/resources/maps/m5.txt b/src/main/resources/maps/m5.txt deleted file mode 100644 index 8e17f5d..0000000 --- a/src/main/resources/maps/m5.txt +++ /dev/null @@ -1,11 +0,0 @@ -10 10 -EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY -EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY -EMPTY EMPTY EMPTY BLOCK MOVETO,5,3,m1 BLOCK EMPTY EMPTY EMPTY EMPTY -EMPTY EMPTY EMPTY BLOCK SPAWN BLOCK EMPTY EMPTY EMPTY EMPTY -EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY -EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY -BLOCK EMPTY EMPTY BLOCK BLOCK BLOCK EMPTY BLOCK EMPTY EMPTY -BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY -BLOCK BLOCK EMPTY BLOCK BLOCK BLOCK EMPTY BLOCK BLOCK EMPTY -EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY \ No newline at end of file diff --git a/src/main/resources/maps/m5-cellmap.txt b/src/main/resources/maps/tutorial-cellmap.txt similarity index 100% rename from src/main/resources/maps/m5-cellmap.txt rename to src/main/resources/maps/tutorial-cellmap.txt diff --git a/src/main/resources/maps/tutorial-objectset.txt b/src/main/resources/maps/tutorial-objectset.txt new file mode 100644 index 0000000..17be624 --- /dev/null +++ b/src/main/resources/maps/tutorial-objectset.txt @@ -0,0 +1,13 @@ +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 \ No newline at end of file diff --git a/src/main/resources/maps/tutorial-tileset.txt b/src/main/resources/maps/tutorial-tileset.txt new file mode 100644 index 0000000..9434c54 --- /dev/null +++ b/src/main/resources/maps/tutorial-tileset.txt @@ -0,0 +1,16 @@ + A2_Ground.png 512 384 32 192 + D_OutDoor.png 512 512 32 256 + tutorialtiles.png 288 96 32 448 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 448 451 454 457 460 463 466 469 472 1 1 +1 1 449 452 455 458 461 464 467 470 473 1 1 +1 1 450 453 456 459 462 465 468 471 474 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 diff --git a/src/main/resources/maps/tutorial.txt b/src/main/resources/maps/tutorial.txt new file mode 100644 index 0000000..5e14033 --- /dev/null +++ b/src/main/resources/maps/tutorial.txt @@ -0,0 +1,14 @@ +13 13 +BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY MOVETO,5,4,m1 BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK \ No newline at end of file diff --git a/src/main/resources/save/newGame/maps.txt b/src/main/resources/save/newGame/maps.txt index fd103b4..d26d6de 100644 --- a/src/main/resources/save/newGame/maps.txt +++ b/src/main/resources/save/newGame/maps.txt @@ -2,8 +2,8 @@ m1 m2 m3 m4 -m5 m6 +tutorial openspace office boss diff --git a/src/main/resources/save/savedGame/events.txt b/src/main/resources/save/savedGame/events.txt index e69de29..0dd4360 100644 --- a/src/main/resources/save/savedGame/events.txt +++ b/src/main/resources/save/savedGame/events.txt @@ -0,0 +1,90 @@ + + m1 + + + + + m2 + + + 7 + 2 + true + + + + + m3 + + + 2 + 5 + true + + + + + m4 + + + 3 + 3 + true + + + + + m6 + + + 11 + 11 + true + + + + + tutorial + + + + + openspace + + + 7 + 4 + true + + + 15 + 7 + true + + + + + office + + + 1 + 9 + true + + + + + boss + + + 4 + 18 + true + + + + + treasure + + + diff --git a/src/main/resources/save/savedGame/person.txt b/src/main/resources/save/savedGame/person.txt index e69de29..da4d904 100644 --- a/src/main/resources/save/savedGame/person.txt +++ b/src/main/resources/save/savedGame/person.txt @@ -0,0 +1,6 @@ + + openspace + 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 e69de29..1b4bc7b 100644 --- a/src/main/resources/save/savedGame/village.txt +++ b/src/main/resources/save/savedGame/village.txt @@ -0,0 +1 @@ +TODO: Village \ No newline at end of file diff --git a/src/main/resources/tutorialtiles.png b/src/main/resources/tutorialtiles.png new file mode 100644 index 0000000..a023dfd Binary files /dev/null and b/src/main/resources/tutorialtiles.png differ