예제 #1
0
  public void update(int delta, Character owner, Character other) {
    if (attackPhase == 0 && progress > beginRunTime) {
      owner.move(new Vector2f(runSpeed * delta * (facingRight ? 1 : -1), 0f));
      if (Math.abs(other.getX() - owner.getX()) < whackDistance) {
        whackBeginTime = progress;
        attackPhase++;
      }
    } else if (attackPhase == 1 && progress > whackBeginTime + whackHurtTime) {
      attackPhase++;
    } else if (attackPhase == 2
        && (hasHit || progress > whackBeginTime + whackHurtTime + whackDuration)) {
      attackPhase++;
    } else if (attackPhase == 3
        && progress > whackBeginTime + whackHurtTime + whackDuration + whackRecoverTime) {
      finishAttack(owner);
    }

    super.update(delta, owner, other);
  }
예제 #2
0
 public void finishAttack(Character owner) {
   super.finishAttack(owner);
   owner.setGravityMultiplier(1f);
 }
예제 #3
0
 public void start(Character owner, boolean facingRight) {
   super.start(owner, facingRight);
   owner.setGravityMultiplier(.4f);
 }
예제 #4
0
 public boolean canDoDamage(Character other) {
   return attackPhase == 2
       && progress > whackBeginTime + whackHurtTime
       && !hasHit
       && other.getHitbox().intersects(hitBox);
 }