improved camera in dialog

This commit is contained in:
musilto9 2020-04-16 11:26:33 +02:00
parent 6df16a9a68
commit 1fc63bd1d9
3 changed files with 23 additions and 4 deletions

View File

@ -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("<wait>")) {

View File

@ -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; }
}

View File

@ -1,6 +1,6 @@
<location>
<map>openspace</map>
<x>8</x>
<y>16</y>
<direction>3</direction>
<map>boss</map>
<x>4</x>
<y>18</y>
<direction>2</direction>
</location>