diff --git a/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java b/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java index 4183b5c..a979b81 100644 --- a/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java +++ b/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java @@ -99,8 +99,10 @@ public class InteractionCell extends Cell { if (!window.getCamera().getCameraBound()) { window.getCamera().returnFreeCamera(); } - WindowOfFreeMove.setCanPersonMove(true); - Person.setInEvent(false); + else { + Person.setInEvent(false); + WindowOfFreeMove.setCanPersonMove(true); + } } @Override diff --git a/src/main/java/ruscz/game/gameOfProd/Windows/Camera.java b/src/main/java/ruscz/game/gameOfProd/Windows/Camera.java index 79be316..2b88a24 100644 --- a/src/main/java/ruscz/game/gameOfProd/Windows/Camera.java +++ b/src/main/java/ruscz/game/gameOfProd/Windows/Camera.java @@ -78,12 +78,20 @@ public class Camera { if (coordX != endX || coordY != endY) { int distanceX = endX - startX; int distanceY = endY - startY; + if (Math.abs(distanceX) < CELL_SIZE && Math.abs(distanceY) < CELL_SIZE) { + isBound = true; + isReturning = false; + return; + } int stepX = distanceX * speed / CELL_SIZE; int stepY = distanceY * speed / CELL_SIZE; canvas.setLocation(coordX + stepX, coordY + stepY); } if (coordX == endX && coordY == endY && isReturning) { isBound = true; + isReturning = false; + window.setCanPersonMove(true); + window.getMapPainter().getActualMap().getPerson().setInEvent(false); } } @@ -105,7 +113,6 @@ public class Camera { } speed = 1; isReturning = true; - isBound = true; //SMTH WRONG, BUT IT WORKS } public void setCameraStart() { diff --git a/src/main/resources/roses-are-red.txt b/src/main/resources/roses-are-red.txt index 2f52d7f..b42d635 100644 --- a/src/main/resources/roses-are-red.txt +++ b/src/main/resources/roses-are-red.txt @@ -1,4 +1,4 @@ Roses are red
violets are blue - -40 0 1 + -240 -40 1 unexpected "{"
on line 32 \ No newline at end of file