added walk-in doors
This commit is contained in:
parent
44d3732275
commit
25aa2271a1
@ -121,22 +121,30 @@ public class Map {
|
||||
switch (cell.getDirectionOut()) {
|
||||
case 1:
|
||||
person.set(cell.getX(), cell.getY() - 1);
|
||||
person.setDirectionMoveLast(0);
|
||||
person.setIsMoving(true);
|
||||
person.setDirectionMoveLast(WindowOfFreeMove.KEY_UP);
|
||||
person.setSize(WindowOfFreeMove.CELL_SIZE);
|
||||
person.setDirectionSight(2);
|
||||
break;
|
||||
case 2:
|
||||
person.set(cell.getX() + 1, cell.getY());
|
||||
person.setDirectionMoveLast(0);
|
||||
person.setIsMoving(true);
|
||||
person.setDirectionMoveLast(WindowOfFreeMove.KEY_RIGHT);
|
||||
person.setSize(WindowOfFreeMove.CELL_SIZE);
|
||||
person.setDirectionSight(3);
|
||||
break;
|
||||
case 3:
|
||||
person.set(cell.getX(), cell.getY() + 1);
|
||||
person.setDirectionMoveLast(0);
|
||||
person.setIsMoving(true);
|
||||
person.setDirectionMoveLast(WindowOfFreeMove.KEY_DOWN);
|
||||
person.setSize(WindowOfFreeMove.CELL_SIZE);
|
||||
person.setDirectionSight(0);
|
||||
break;
|
||||
case 4:
|
||||
person.set(cell.getX() - 1, cell.getY());
|
||||
person.setDirectionMoveLast(0);
|
||||
person.setIsMoving(true);
|
||||
person.setDirectionMoveLast(WindowOfFreeMove.KEY_LEFT);
|
||||
person.setSize(WindowOfFreeMove.CELL_SIZE);
|
||||
person.setDirectionSight(1);
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -79,7 +79,10 @@ public class Person extends Cell {
|
||||
directionMoveLast = 0;
|
||||
}
|
||||
if (WindowOfFreeMove.getMap().isCellMoveTo(x, y)) {
|
||||
WindowOfFreeMove.getMap().findEventByXY(x, y).moveToMap();
|
||||
set(x, y);
|
||||
if (!isMoving) {
|
||||
WindowOfFreeMove.getMap().findEventByXY(x, y).moveToMap();
|
||||
}
|
||||
} else {
|
||||
if (!WindowOfFreeMove.getMap().isBusyCell(x, y)) {
|
||||
set(x, y);
|
||||
@ -91,6 +94,8 @@ public class Person extends Cell {
|
||||
public void stopPerson(){
|
||||
directionMove = 0;
|
||||
directionMoveLast = 0;
|
||||
size = 0;
|
||||
isMoving = false;
|
||||
}
|
||||
|
||||
public boolean isInPerson(int x, int y) {
|
||||
@ -131,7 +136,7 @@ public class Person extends Cell {
|
||||
}
|
||||
}
|
||||
|
||||
private void animateMove(Graphics2D g, int direction){
|
||||
public void animateMove(Graphics2D g, int direction){
|
||||
int Xsize = 0;
|
||||
int Ysize = 0;
|
||||
switch (direction) {
|
||||
@ -166,4 +171,12 @@ public class Person extends Cell {
|
||||
public boolean getIsMoving() {
|
||||
return isMoving;
|
||||
}
|
||||
|
||||
public void setIsMoving(boolean isMoving) {
|
||||
this.isMoving = isMoving;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user