private void buildMetroCity(int maxX, int maxY) { int midX = maxX / 2; int midY = maxY / 2; cityPlan.add(new Coords(midX, midY)); // have the city hub be the mid point with all the hexes around it // cleared out for (int hex = 0; hex < 6; hex++) cityPlan.add(new Coords(Coords.xInDir(midX, midY, hex), Coords .yInDir(midX, midY, hex))); // first east west road Coords coords = new Coords(-1, midY / 2); buildStraightRoad(coords, E, 1); // second east west road coords = new Coords(-1, midY + (midY / 2)); buildStraightRoad(coords, E, 1); // First North South Road coords = new Coords(midX / 2, -1); buildStraightRoad(coords, S, 1); // second North South Road coords = new Coords(midX + (midX / 2), -1); buildStraightRoad(coords, S, 1); for (int dir = 0; dir < 8; dir++) { coords = new Coords(midX, midY); buildStraightRoad(coords, dir, 2); } }
/** * Adds an Road to the map. Goes from one border to another, and has one * turn in it. Map must be at least 3x3. */ private void addGenericRoad() { Coords c = new Coords(Compute.randomInt(board.getWidth()), Compute .randomInt(board.getHeight())); int side0 = Compute.randomInt(6); int side1 = Compute.randomInt(5); if (side1 >= side0) { side1++; } buildStraightRoad(c, side0, 1); buildStraightRoad(c, side1, 1); } }
private void buildGridCity(int maxX, int maxY, int roads) { for (int y = 0; y < roads; y++) { int startY = Compute.randomInt(maxY / roads) + ((y * maxY) / roads); // int start = Compute.randomInt(2); Coords coords = new Coords(-1, startY); int roadStyle = Compute.randomInt(2) + 1; int dir = Compute.randomInt(2) + NE; buildStraightRoad(coords, dir, roadStyle); startY = Compute.randomInt(maxY / roads) + ((y * maxY) / roads); coords = new Coords(maxX, startY); dir = Compute.randomInt(2) + SW; buildStraightRoad(coords, dir, roadStyle); } for (int x = 0; x < roads; x++) { int startX = Compute.randomInt(maxX / roads) + (x * (maxX / roads)); Coords coords = new Coords(startX, -1); int roadStyle = Compute.randomInt(2) + 1; buildStraightRoad(coords, S, roadStyle); } }