Ejemplo n.º 1
0
  public boolean use(Entity source, Item item) {
    if (hurtTime > 0) return false;
    if (item != Item.powerGlove) return false;

    hurt(Math.sin(source.rot), Math.cos(source.rot));

    return true;
  }
Ejemplo n.º 2
0
  public void tick() {
    if (hurtTime > 0) {
      hurtTime--;
      if (hurtTime == 0) {
        sprite.col = defaultColor;
      }
    }
    animTime++;
    sprite.tex = defaultTex + animTime / 10 % 2;
    move();
    if (xa == 0 || za == 0) {
      rota += (random.nextGaussian() * random.nextDouble()) * 0.3;
    }

    rota += (random.nextGaussian() * random.nextDouble()) * spinSpeed;
    rot += rota;
    rota *= 0.8;
    xa *= 0.8;
    za *= 0.8;
    xa += Math.sin(rot) * 0.004 * runSpeed;
    za += Math.cos(rot) * 0.004 * runSpeed;
  }