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); }
public void finishAttack(Character owner) { super.finishAttack(owner); owner.setGravityMultiplier(1f); }
public void start(Character owner, boolean facingRight) { super.start(owner, facingRight); owner.setGravityMultiplier(.4f); }
public boolean canDoDamage(Character other) { return attackPhase == 2 && progress > whackBeginTime + whackHurtTime && !hasHit && other.getHitbox().intersects(hitBox); }