Package settlers.game.data

Examples of settlers.game.data.MapCoord


        // settlements
        if ((yOnScreen + 12) % theme.Y_TILE_OFFSET <= 20) {// selects
          // settlements on the right side
          if ((((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) % 2 == 1) {// checks
            // if row is up or down (this one is down)
            coords[0] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) - 1,
                (yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
            coords[1] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
                (yOnScreen + 20) / theme.Y_TILE_OFFSET - 2);
            coords[2] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
                (yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
          } else { // this one is up
            coords[0] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) - 1,
                (yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
            coords[1] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
                (yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
            coords[2] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
                (yOnScreen + 20) / theme.Y_TILE_OFFSET);
          }
        }

        if ((yOnScreen + 45) % 66 <= 20) {// selects settlements on the
          // left side
          if ((((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) % 2 == 1) {// checks
            // if row is up or down (this one is down)
            coords[0] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) - 1,
                (yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
            coords[1] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2)
                    / theme.X_TILE_OFFSET - 1),
                (yOnScreen + 20) / theme.Y_TILE_OFFSET);
            coords[2] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
                (yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
          } else {// this one is up
            coords[0] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) - 1,
                (yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
            coords[1] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2)
                    / theme.X_TILE_OFFSET - 1),
                (yOnScreen + 20) / theme.Y_TILE_OFFSET);
            coords[2] = new MapCoord(
                (((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
                (yOnScreen + 20) / theme.Y_TILE_OFFSET);
          }
        }
        // System.out.println(Arrays.toString(coords));
        return coords;
      }
    }

    xOnScreen = xStorage;
    yOnScreen = yStorage;
    if (SettlerMap.isPartofDownRow(isOriginDown, xOrd))
      yOnScreen -= 33;

    if ((xOnScreen) % theme.X_TILE_OFFSET > theme.TRIANGLE_AREA_WIDTH) {// horizontal
      // pieces
      if ((yOnScreen + 10) % theme.Y_TILE_OFFSET <= 22) {

        coords = new MapCoord[2];
        coords[0] = new MapCoord(xOrd, (yOnScreen + 46) / 66 - 1);
        coords[1] = new MapCoord(xOrd, (yOnScreen + 46) / 66);

      } else {
        coords = new MapCoord[1];
        coords[0] = new MapCoord(xOrd, yOrd);
      }
    } else {// is part of the central rectangle (diagonal pieces)
      coords = new MapCoord[2];
      coords[0] = new MapCoord();
      coords[1] = new MapCoord();

      coords[0].setX(xOrd - 1);
      coords[1].setX(xOrd);

      if (SettlerMap.isPartofDownRow(isOriginDown, xOrd)) {// part of down
        // row
        if ((yOnScreen + 66) % theme.Y_TILE_OFFSET <= theme.Y_TILE_OFFSET / 2) {
          // Diagonal Left
          coords[0] = new MapCoord(xOrd - 1, yOrd - 1);
          coords[1] = new MapCoord(xOrd, yOrd - 1);
        } else {
          // Diagonal Right
          coords[0] = new MapCoord(xOrd - 1, yOrd);
          coords[1] = new MapCoord(xOrd, yOrd - 1);
        }
      } else {// part of up row
        if (yOnScreen % theme.Y_TILE_OFFSET <= theme.Y_TILE_OFFSET / 2) {
          // Diagonal Left
          coords[0] = new MapCoord(xOrd - 1, yOrd - 1);
          coords[1] = new MapCoord(xOrd, yOrd);
        } else {
          // Diagonal Right
          coords[0] = new MapCoord(xOrd - 1, yOrd);
          coords[1] = new MapCoord(xOrd, yOrd);
        }
      }
    }
    return coords;
  }
View Full Code Here


    for (int x = 0; x < map.chance.length; x++) {
      for (int y = 0; y < map.chance[0].length; y++) {
        if (map.chance[x][y] == roll) {
          activatedTiles[activatedTiles.length
              - tilesLeftToBeActivated] = new MapCoord(x, y);
          tilesLeftToBeActivated--;
          if (tilesLeftToBeActivated == 0)
            break;
        }
      }
View Full Code Here

  public static MapCoord findFirstInstance(TileTypes type, SettlerMap map) {
    for (int x = 0; x < map.width; x++) {
      for (int y = 0; y < map.height; y++) {
        if (map.getTileAt(x, y) == type)
          return new MapCoord(x, y);
      }
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of settlers.game.data.MapCoord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.