using UnityEngine; public class StompCollider : MonoBehaviour { public float bounceForce = 10f; private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { // Bounce the player Rigidbody2D rb = other.GetComponent(); if (rb != null) { rb.linearVelocity = new Vector2(rb.linearVelocity.x, bounceForce); } // Destroy the whole enemy (parent of the StompCollider) Destroy(transform.parent.gameObject); } } }