diff --git a/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java b/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java index 514f68a..ea0538f 100644 --- a/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java +++ b/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java @@ -65,6 +65,8 @@ public class InteractionCell extends Cell { window.getCamera().setCameraEnd(Integer.parseInt(cameraInfo[1]), Integer.parseInt(cameraInfo[2])); window.getCamera().setCameraTime(Double.parseDouble(cameraInfo[3])); window.getCamera().setCameraStopped(false); + if (!window.getCamera().getIsFirstMove()) + window.getCamera().setCameraFirstMove(true); readNextLine(); } else if (data.contains("")) { diff --git a/src/main/java/ruscz/game/gameOfProd/Windows/Camera.java b/src/main/java/ruscz/game/gameOfProd/Windows/Camera.java index 4c2b903..67ba39f 100644 --- a/src/main/java/ruscz/game/gameOfProd/Windows/Camera.java +++ b/src/main/java/ruscz/game/gameOfProd/Windows/Camera.java @@ -14,6 +14,7 @@ public class Camera { private boolean isReturning; private boolean isStopped; private int count; + private boolean isFirstMove; public Camera(WindowOfFreeMove window, WindowOfFreeMove.Canvas canvas) { this.window = window; @@ -132,6 +133,18 @@ public class Camera { canvas.setLocation(coordX + stepX, coordY + stepY); count++; } + else if (isFirstMove) { + int x = window.getMapManager().getActualMap().getPerson().getX(); + int y = window.getMapManager().getActualMap().getPerson().getY(); + int dir = window.getMapManager().getActualMap().getPerson().getDirectionSight(); + if (window.getMapManager().getActualMap().findTriggerByXY(x, y) != null) { + window.getMapManager().getActualMap().findTriggerByXY(x, y).readNextLine(); + } + else if (window.getMapManager().getActualMap().findInteractionByXY(x, y, dir) != null) { + window.getMapManager().getActualMap().findInteractionByXY(x, y, dir).readNextLine(); + } + isFirstMove = false; + } if (Math.abs(coordX - endX) <= stepX && Math.abs(coordY - endY) <= stepY && isReturning) boundCamera(); } @@ -181,4 +194,8 @@ public class Camera { public boolean getCameraBound() { return isBound; } public void setCameraStopped(boolean stopped) { isStopped = stopped; } + + public void setCameraFirstMove(boolean move) { isFirstMove = move; } + + public boolean getIsFirstMove() { return isFirstMove; } } diff --git a/src/main/resources/save/savedGame/person.txt b/src/main/resources/save/savedGame/person.txt index da4d904..a9fc868 100644 --- a/src/main/resources/save/savedGame/person.txt +++ b/src/main/resources/save/savedGame/person.txt @@ -1,6 +1,6 @@ - openspace - 8 - 16 - 3 + boss + 4 + 18 + 2 \ No newline at end of file