added walk-in doors
This commit is contained in:
parent
44d3732275
commit
25aa2271a1
@ -121,22 +121,30 @@ public class Map {
|
|||||||
switch (cell.getDirectionOut()) {
|
switch (cell.getDirectionOut()) {
|
||||||
case 1:
|
case 1:
|
||||||
person.set(cell.getX(), cell.getY() - 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);
|
person.setDirectionSight(2);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
person.set(cell.getX() + 1, cell.getY());
|
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);
|
person.setDirectionSight(3);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
person.set(cell.getX(), cell.getY() + 1);
|
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);
|
person.setDirectionSight(0);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
person.set(cell.getX() - 1, cell.getY());
|
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);
|
person.setDirectionSight(1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -79,7 +79,10 @@ public class Person extends Cell {
|
|||||||
directionMoveLast = 0;
|
directionMoveLast = 0;
|
||||||
}
|
}
|
||||||
if (WindowOfFreeMove.getMap().isCellMoveTo(x, y)) {
|
if (WindowOfFreeMove.getMap().isCellMoveTo(x, y)) {
|
||||||
WindowOfFreeMove.getMap().findEventByXY(x, y).moveToMap();
|
set(x, y);
|
||||||
|
if (!isMoving) {
|
||||||
|
WindowOfFreeMove.getMap().findEventByXY(x, y).moveToMap();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!WindowOfFreeMove.getMap().isBusyCell(x, y)) {
|
if (!WindowOfFreeMove.getMap().isBusyCell(x, y)) {
|
||||||
set(x, y);
|
set(x, y);
|
||||||
@ -91,6 +94,8 @@ public class Person extends Cell {
|
|||||||
public void stopPerson(){
|
public void stopPerson(){
|
||||||
directionMove = 0;
|
directionMove = 0;
|
||||||
directionMoveLast = 0;
|
directionMoveLast = 0;
|
||||||
|
size = 0;
|
||||||
|
isMoving = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInPerson(int x, int y) {
|
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 Xsize = 0;
|
||||||
int Ysize = 0;
|
int Ysize = 0;
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
@ -166,4 +171,12 @@ public class Person extends Cell {
|
|||||||
public boolean getIsMoving() {
|
public boolean getIsMoving() {
|
||||||
return isMoving;
|
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