Ejemplo 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);
  }
Ejemplo n.º 2
0
 public static void loadImages() {
   activeImg =
       Game.getGame().robustLoadImage("rec/img/blocks/solidBlockON.png", "Polite Solid Block ON");
   inactiveImg =
       Game.getGame()
           .robustLoadImage("rec/img/blocks/solidBlockOFF.png", "Polite Solid Block OFF");
   topActiveImg =
       Game.getGame()
           .robustLoadImage("rec/img/blocks/solidBlockON_G.png", "Polite Solid Block ON (TOP)");
   topInactiveImg =
       Game.getGame()
           .robustLoadImage("rec/img/blocks/solidBlockOFF_G.png", "Polite Solid Block OFF (TOP)");
 }
Ejemplo n.º 3
0
 public void onTickAction(Game game, double xPos, double yPos, short state) {
   if (state > 0)
     game.addEnemyHitbox(
         new Rectangle2D.Double(
             xPos + HITBOX_OFFSET.x,
             yPos + HITBOX_OFFSET.y,
             HITBOX_OFFSET.width,
             HITBOX_OFFSET.height));
 }
Ejemplo n.º 4
0
 public short update(int x, int y, Game game) {
   return game.getCellLastState(x, y);
 }
Ejemplo n.º 5
0
 public static void loadImage() {
   img = Game.getGame().robustLoadImage("rec/img/blocks/isolatedCell.png", "Isolated Cell");
 }
Ejemplo n.º 6
0
 public static void loadImages() {
   activeImg =
       Game.getGame().robustLoadImage("rec/img/blocks/death_block_OFF.png", "Death Block ON");
   inactiveImg =
       Game.getGame().robustLoadImage("rec/img/blocks/death_block_OFF.png", "Death Block OFF");
 }