TO SQUASH: better ball collisions.
This commit is contained in:
@@ -36,7 +36,9 @@ public class BasicBall : MonoBehaviour
|
||||
|
||||
void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
if (collision.gameObject.CompareTag("Wall") || collision.gameObject.CompareTag("Ball"))
|
||||
if (collision.gameObject.CompareTag("Wall") ||
|
||||
collision.gameObject.CompareTag("BasicBall") ||
|
||||
collision.gameObject.CompareTag("FruitBall"))
|
||||
{
|
||||
ContactPoint2D contact = collision.GetContact(0);
|
||||
speed = Vector2.Reflect(speed, contact.normal);
|
||||
|
||||
@@ -50,12 +50,15 @@ public class FruitBall : MonoBehaviour
|
||||
|
||||
void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
if (collision.gameObject.CompareTag("Wall") || collision.gameObject.CompareTag("Ball"))
|
||||
if (collision.gameObject.CompareTag("Wall") ||
|
||||
collision.gameObject.CompareTag("BasicBall") ||
|
||||
collision.gameObject.CompareTag("FruitBall"))
|
||||
{
|
||||
ContactPoint2D contact = collision.GetContact(0);
|
||||
speed = Vector2.Reflect(speed, contact.normal);
|
||||
|
||||
if (collision.gameObject.CompareTag("Ball"))
|
||||
if (collision.gameObject.CompareTag("BasicBall") ||
|
||||
collision.gameObject.CompareTag("FruitBall"))
|
||||
{
|
||||
speedIncreaseTimer = 2.0f; // Reset the timer to 2 seconds
|
||||
speedMultiplier = 50.0f; // Set the speed multiplier to 7x
|
||||
|
||||
@@ -29,7 +29,7 @@ public class OozeBall : MonoBehaviour
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
animator = GetComponent<Animator>();
|
||||
speed = new Vector2(Random.Range(-0.005f, 0.005f), Random.Range(-0.005f, 0.005f));
|
||||
speed = new Vector2(Random.Range(-0.002f, 0.002f), Random.Range(-0.002f, 0.002f));
|
||||
|
||||
audioSource.PlayOneShot(spawnSound);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user