Exemple #1
0
  public void drawVisibleMap(Graphics g) {
    for (Tile t : tiles) {
      if (t.intersects(display)) {
        double dx = t.x - display.getX();
        double dy = t.y - display.getY();

        g.drawImage((Image) (control.getImageAt(t.getImageNumber())), (int) dx, (int) dy, null);
      }
    }
  }
Exemple #2
0
  public Color getColorForPoint(Point p) {
    for (Tile t : tiles) {
      double dx = t.x - display.getX();
      double dy = t.y - display.getY();

      Rectangle temp2 = new Rectangle((int) dx, (int) dy, (int) t.getWidth(), (int) t.getHeight());

      if (temp2.contains(p)) {
        int px = (int) (p.x - dx);
        int py = (int) (p.y - dy);

        Color c =
            new Color(
                ImageControl.getInstance().getShadowImageAt(t.getImageNumber()).getRGB(px, py));
        return c;
      }
    }
    return null;
  }