Advertisement
GUPPYYYY

Hit Stomp

Oct 31st, 2024
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5.  
  6. public class HitStomp : MonoBehaviour
  7. {
  8.     public float bounce;
  9.     public Rigidbody rb;
  10.     void Start()
  11.     {
  12.  
  13.     }
  14.  
  15.     // Update is called once per frame
  16.     void Update()
  17.     {
  18.  
  19.     }
  20.  
  21.     void OnTriggerEnter(Collider other)
  22.     {
  23.         if (other.gameObject.tag == "WeakPoint")
  24.         {
  25.             Destroy(other.transform.parent.gameObject);
  26.             rb.velocity = new Vector2(rb.velocity.x, bounce);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement