TO SQUASH: shark movement.

This commit is contained in:
2026-08-11 21:47:03 -04:00
parent d15c7002a8
commit e1c418499f
11 changed files with 327 additions and 80 deletions
+13 -2
View File
@@ -86,17 +86,28 @@ public class FruitBall : BallBase
{
if (collision.gameObject.CompareTag("Wall") ||
collision.gameObject.CompareTag("BasicBall") ||
collision.gameObject.CompareTag("FruitBall"))
collision.gameObject.CompareTag("FruitBall") ||
collision.gameObject.CompareTag("Shark"))
{
ContactPoint2D contact = collision.GetContact(0);
speed = Vector2.Reflect(speed, contact.normal);
if (collision.gameObject.CompareTag("BasicBall") ||
collision.gameObject.CompareTag("FruitBall"))
collision.gameObject.CompareTag("FruitBall") ||
collision.gameObject.CompareTag("Shark"))
{
speedIncreaseTimer = 2.0f; // Reset the timer to 2 seconds
speedMultiplier = 20.0f; // Set the speed multiplier to 7x
}
if (collision.gameObject.CompareTag("Shark"))
{
audioSource.PlayOneShot(bounceSound);
}
}
else
{
Physics2D.IgnoreCollision(collision.collider, GetComponent<Collider2D>(), true);
}
}
}