public void onHitting(EnemyEntity other) { other.Health -= Attack; Vector2 knockbackVelocity = other.Position - position; knockbackVelocity.Normalize(); knockbackVelocity *= 4f; other.setKnockback(knockbackVelocity); enemyHit.Play(); }
public void onGettingHit(EnemyEntity other) { Health -= other.Attack; Vector2 knockbackVelocity = position - other.Position; knockbackVelocity.Normalize(); knockbackVelocity *= 4f; setKnockback(knockbackVelocity); playerHit.Play(); }