public void setStatic() { if ((direction == Directions.left && predirection == Directions.left) || (direction == Directions.right && predirection == Directions.right)) { stat = BodyStatic.horizontal; } if ((direction == Directions.up && predirection == Directions.up) || (direction == Directions.down && predirection == Directions.down)) { stat = BodyStatic.vertical; } if ((direction == Directions.up && predirection == Directions.right) || (direction == Directions.left && predirection == Directions.down)) { stat = BodyStatic.lefttop; } if ((direction == Directions.right && predirection == Directions.down) || (direction == Directions.up && predirection == Directions.left)) { stat = BodyStatic.topright; } if ((direction == Directions.left && predirection == Directions.up) || (direction == Directions.down && predirection == Directions.right)) { stat = BodyStatic.bottomleft; } if ((direction == Directions.right && predirection == Directions.up) || (direction == Directions.down && predirection == Directions.left)) { stat = BodyStatic.bottomright; } }
public void setStatic(Entity prebody, Entity nextbody) { if ((prebody.y == y && prebody.x < x && nextbody.y == y && nextbody.x > x) || (nextbody.y == y && nextbody.x < x && prebody.y == y && prebody.x > x)) { stat = BodyStatic.horizontal; } if ((prebody.x == x && prebody.y < y && nextbody.x == x && nextbody.y > y) || (nextbody.x == x && nextbody.y < y && prebody.x == x && prebody.y > y)) { stat = BodyStatic.vertical; } if ((prebody.x < x && prebody.y == y && nextbody.x == x && nextbody.y < y) || (nextbody.x < x && nextbody.y == y && prebody.x == x && prebody.y < y)) { stat = BodyStatic.lefttop; } if ((prebody.y == y && prebody.x > x && nextbody.x == x && nextbody.y < y) || (nextbody.y == y && nextbody.x > x && prebody.x == x && prebody.y < y)) { stat = BodyStatic.topright; } if ((prebody.y == y && prebody.x > x && nextbody.x == x && nextbody.y > y) || (nextbody.y == y && nextbody.x > x && prebody.x == x && prebody.y > y)) { stat = BodyStatic.bottomright; } if ((prebody.y == y && prebody.x < x && nextbody.y > y && nextbody.x == x) || (nextbody.y == y && nextbody.x < x && prebody.y > y && prebody.x == x)) { stat = BodyStatic.bottomleft; } }