boing boing mf

This commit is contained in:
allylikesfrogs 2023-05-04 13:31:41 -07:00
parent a6caababa3
commit 17c35b411e

View File

@ -4,15 +4,18 @@ using UnityEngine;
public class WaterBehavior : MonoBehaviour public class WaterBehavior : MonoBehaviour
{ {
// Start is called before the first frame update public Rigidbody2D RB;
void Start()
[SerializeField] private float bounceForce = 2;
void OnCollisionEnter2D(Collision2D col)
{ {
Bounce();
} }
// Update is called once per frame private void Bounce()
void Update()
{ {
RB.velocity = new Vector2(RB.velocity.x, -(RB.velocity.y));
RB.AddForce(RB.velocity * bounceForce, ForceMode2D.Impulse);
} }
} }