Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.kfgeeks.java.Mapper;
- public class MapBuilder {
- public static void run(int x, int y){
- Map worldMap = new Map();
- worldMap = buildMap(x, y);
- worldMap = IslandBuilder.run(worldMap);
- printMap(worldMap);
- }
- private static Map buildMap(int x, int y) {
- Map worldMap = new Map();
- worldMap.setHeight(x);
- worldMap.setWidth(y);
- worldMap.mapCells = new Cell[worldMap.getHeight()][];
- for (int i = 0; i < worldMap.mapCells.length; i++) {
- worldMap.mapCells[i] = new Cell[worldMap.getWidth()];
- for (int j = 0; j < worldMap.mapCells[i].length; j++) {
- worldMap.mapCells[i][j] = new Cell();
- worldMap.mapCells[i][j].setTerrain(0);
- }
- }
- return worldMap;
- }
- // Just a clever little Print function();
- @SuppressWarnings("unused")
- private void print(String s) {
- System.out.println(s);
- }
- private static void printMap(Map passWorld_Map) {
- Map worldMap = passWorld_Map;
- for (int i = 0; i < worldMap.mapCells.length; i++) {
- for (int j = 0; j < worldMap.mapCells[i].length; j++) {
- System.out.print(worldMap.mapCells[i][j].getTerrain_Char());
- }
- System.out.print("\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement