Esempio n. 1
0
  public void draw(Graphics g, int xPos, int yPos, short state) {
    BufferedImage src;
    boolean top = false;
    if (popFrame > 0) {
      if (updatePopFrame) {
        popFrame++;
        if (popFrame >= POP_FRAME_COUNT) popFrame = 0;
      }
    }
    if (popFrame > 0) g.drawImage(PoliteSolidBlock.popImg[popFrame - 1], xPos, yPos, null);

    Game game = Game.getGame();
    Point2D.Double cellID = game.screenToWorld(new Point2D.Double(xPos + 1, yPos + 1));
    cellID = game.worldToCell(cellID);
    cellID.y = cellID.y - 1;
    Cell c = game.getCell((int) (cellID.x), (int) (cellID.y));
    if (c != null)
      if (c.getBlockTypeInt() != Cell.POLITE_SOLID_BLOCK || (c.getState() <= 0 && state > 0))
        top = true;
    if (top) {
      if (state > 0) src = PoliteSolidBlock.topActiveImg;
      else src = PoliteSolidBlock.topInactiveImg;
    } else {
      if (state > 0) src = PoliteSolidBlock.activeImg;
      else src = PoliteSolidBlock.inactiveImg;
    }
    g.drawImage(src, xPos, yPos, null);
  }