Exemplo n.º 1
0
 // dY > dX && dX > 0 == NORTH
 // dX > dY && dX > 0 == EAST
 // dY < dX && dX < 0 == SOUTH
 // dX < dY && dX < 0 == WEST
 public static Directions getDirectionByInteger(final int i, final int j) {
   for (Directions d : Directions.values()) {
     if (d.getX() == i && d.getY() == j) {
       return d;
     }
   }
   return null;
 }
Exemplo n.º 2
0
 public static boolean directionPassable(Directions d, Tile t) {
   final int[][] flags = Walking.getCollisionFlags(Game.getPlane());
   final Tile offset =
       Walking.getCollisionOffset(Game.getPlane()).derive(Game.getBaseX(), Game.getBaseY());
   int toCheckFlag = flags[t.getX() - offset.getX()][t.getY() - offset.getY()];
   return ((toCheckFlag & ~d.getBlockFlag()) == toCheckFlag);
 }