Exemplo n.º 1
0
  @Override
  public void use() {
    swingSound.play();
    using = true;
    ((Link) user).attackFace(user.face());

    switch (user.face()) {
      case NORTH:
        sprite = spriteN;
        locate(user.x() - 2, user.y() - 9);
        break;
      case EAST:
        sprite = spriteE;
        locate(user.x() + 12, user.y() + 2);
        break;
      case SOUTH:
        sprite = spriteS;
        locate(user.x() - 2, user.y() + 9);
        break;
      case WEST:
        sprite = spriteW;
        locate(user.x() + -12, user.y() + 2);
        break;
    }
    sprite.reset();
  }
Exemplo n.º 2
0
 private void smash(int x, int y) {
   if (x < 0 || y < 0 || x >= game.map().width() || y >= game.map().height()) {
     return;
   }
   if (game.map().metaLayer()[x][y].value() == MetaTilesNumber.ROCK) {
     if (game.map().renderLayers()[1][x][y].rectangleCollide(sprite)) {
       game.map().renderLayers()[1][x][y].value(0);
       game.map().metaLayer()[x][y].value(0);
       game.map().collisionLayer()[x][y].value(0);
       crushSound.play();
     }
   }
 }