fixed return of camera
This commit is contained in:
parent
5741aef781
commit
050344648d
@ -99,8 +99,10 @@ public class InteractionCell extends Cell {
|
|||||||
if (!window.getCamera().getCameraBound()) {
|
if (!window.getCamera().getCameraBound()) {
|
||||||
window.getCamera().returnFreeCamera();
|
window.getCamera().returnFreeCamera();
|
||||||
}
|
}
|
||||||
WindowOfFreeMove.setCanPersonMove(true);
|
else {
|
||||||
Person.setInEvent(false);
|
Person.setInEvent(false);
|
||||||
|
WindowOfFreeMove.setCanPersonMove(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -78,12 +78,20 @@ public class Camera {
|
|||||||
if (coordX != endX || coordY != endY) {
|
if (coordX != endX || coordY != endY) {
|
||||||
int distanceX = endX - startX;
|
int distanceX = endX - startX;
|
||||||
int distanceY = endY - startY;
|
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 stepX = distanceX * speed / CELL_SIZE;
|
||||||
int stepY = distanceY * speed / CELL_SIZE;
|
int stepY = distanceY * speed / CELL_SIZE;
|
||||||
canvas.setLocation(coordX + stepX, coordY + stepY);
|
canvas.setLocation(coordX + stepX, coordY + stepY);
|
||||||
}
|
}
|
||||||
if (coordX == endX && coordY == endY && isReturning) {
|
if (coordX == endX && coordY == endY && isReturning) {
|
||||||
isBound = true;
|
isBound = true;
|
||||||
|
isReturning = false;
|
||||||
|
window.setCanPersonMove(true);
|
||||||
|
window.getMapPainter().getActualMap().getPerson().setInEvent(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +113,6 @@ public class Camera {
|
|||||||
}
|
}
|
||||||
speed = 1;
|
speed = 1;
|
||||||
isReturning = true;
|
isReturning = true;
|
||||||
isBound = true; //SMTH WRONG, BUT IT WORKS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCameraStart() {
|
public void setCameraStart() {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
Roses are red<br/>violets are blue
|
Roses are red<br/>violets are blue
|
||||||
<cameraFree> -40 0 1
|
<cameraFree> -240 -40 1
|
||||||
unexpected "{"<br/>on line 32
|
unexpected "{"<br/>on line 32
|
||||||
<end>
|
<end>
|
||||||
Loading…
x
Reference in New Issue
Block a user