public Point cameraToScreen( float x, float y ) { return new Point( (int)((x - scroll.x) * zoom + this.x), (int)((y - scroll.y) * zoom + this.y)); }
public Point cameraToScreen( float x, float y ) { return new Point( (int)((x - scroll.x) * zoom + this.x), (int)((y - scroll.y) * zoom + this.y)); }
private static Point p2xy( Room room, int p ) { if (p < pasWidth) { return new Point( room.left + 1 + p, room.top + 1); } else if (p < pasWidth + pasHeight) { return new Point( room.right - 1, room.top + 1 + (p - pasWidth) ); } else if (p < pasWidth * 2 + pasHeight) { return new Point( room.right - 1 - (p - (pasWidth + pasHeight)), room.bottom - 1 ); } else { return new Point( room.left + 1, room.bottom - 1 - (p - (pasWidth * 2 + pasHeight)) ); } } }
private static Point p2xy( Room room, int p ) { if (p < pasWidth) { return new Point( room.left + 1 + p, room.top + 1); } else if (p < pasWidth + pasHeight) { return new Point( room.right - 1, room.top + 1 + (p - pasWidth) ); } else if (p < pasWidth * 2 + pasHeight) { return new Point( room.right - 1 - (p - (pasWidth + pasHeight)), room.bottom - 1 ); } else { return new Point( room.left + 1, room.bottom - 1 - (p - (pasWidth * 2 + pasHeight)) ); } } }
public Point cameraToScreen( float x, float y ) { return new Point( (int)((x - scroll.x) * zoom + this.x), (int)((y - scroll.y) * zoom + this.y)); }
public ArrayList<Point> getPoints() { ArrayList<Point> points = new ArrayList<>(); for (int i = left; i <= right; i++) for (int j = top; j <= bottom; j++) points.add(new Point(i, j)); return points; }
public ArrayList<Point> getPoints() { ArrayList<Point> points = new ArrayList<>(); for (int i = left; i <= right; i++) for (int j = top; j <= bottom; j++) points.add(new Point(i, j)); return points; }
public final ArrayList<Point> waterPlaceablePoints(){ ArrayList<Point> points = new ArrayList<>(); for (int i = left; i <= right; i++) { for (int j = top; j <= bottom; j++) { Point p = new Point(i, j); if (canPlaceWater(p)) points.add(p); } } return points; }
public final ArrayList<Point> trapPlaceablePoints(){ ArrayList<Point> points = new ArrayList<>(); for (int i = left; i <= right; i++) { for (int j = top; j <= bottom; j++) { Point p = new Point(i, j); if (canPlaceTrap(p)) points.add(p); } } return points; }
public final ArrayList<Point> grassPlaceablePoints(){ ArrayList<Point> points = new ArrayList<>(); for (int i = left; i <= right; i++) { for (int j = top; j <= bottom; j++) { Point p = new Point(i, j); if (canPlaceGrass(p)) points.add(p); } } return points; }
public final ArrayList<Point> charPlaceablePoints(Level l){ ArrayList<Point> points = new ArrayList<>(); for (int i = left; i <= right; i++) { for (int j = top; j <= bottom; j++) { Point p = new Point(i, j); if (canPlaceCharacter(p, l)) points.add(p); } } return points; }
public final ArrayList<Point> waterPlaceablePoints(){ ArrayList<Point> points = new ArrayList<>(); for (int i = left; i <= right; i++) { for (int j = top; j <= bottom; j++) { Point p = new Point(i, j); if (canPlaceWater(p)) points.add(p); } } return points; }
public final ArrayList<Point> charPlaceablePoints(Level l){ ArrayList<Point> points = new ArrayList<>(); for (int i = left; i <= right; i++) { for (int j = top; j <= bottom; j++) { Point p = new Point(i, j); if (canPlaceCharacter(p, l)) points.add(p); } } return points; }
public final ArrayList<Point> grassPlaceablePoints(){ ArrayList<Point> points = new ArrayList<>(); for (int i = left; i <= right; i++) { for (int j = top; j <= bottom; j++) { Point p = new Point(i, j); if (canPlaceGrass(p)) points.add(p); } } return points; }
public final ArrayList<Point> trapPlaceablePoints(){ ArrayList<Point> points = new ArrayList<>(); for (int i = left; i <= right; i++) { for (int j = top; j <= bottom; j++) { Point p = new Point(i, j); if (canPlaceTrap(p)) points.add(p); } } return points; }
public Point center() { return new Point( (left + right) / 2 + (((right - left) % 2) == 1 ? Random.Int( 2 ) : 0), (top + bottom) / 2 + (((bottom - top) % 2) == 1 ? Random.Int( 2 ) : 0) ); }
public Point center() { return new Point( (left + right) / 2 + (((right - left) & 1) == 1 ? Random.Int( 2 ) : 0), (top + bottom) / 2 + (((bottom - top) & 1) == 1 ? Random.Int( 2 ) : 0) ); }
public Point center() { return new Point( (left + right) / 2 + (((right - left) % 2) == 1 ? Random.Int( 2 ) : 0), (top + bottom) / 2 + (((bottom - top) % 2) == 1 ? Random.Int( 2 ) : 0) ); }
public Point random( int m ) { return new Point( Random.IntRange( left + m, right - m ), Random.IntRange( top + m, bottom - m )); }
protected final Point getDoorCenter(){ PointF doorCenter = new PointF(0, 0); for (Door door : connected.values()) { doorCenter.x += door.x; doorCenter.y += door.y; } Point c = new Point((int)doorCenter.x / connected.size(), (int)doorCenter.y / connected.size()); if (Random.Float() < doorCenter.x % 1) c.x++; if (Random.Float() < doorCenter.y % 1) c.y++; c.x = (int) GameMath.gate(left+2, c.x, right-2); c.y = (int)GameMath.gate(top+2, c.y, bottom-2); return c; }