using UnityEngine;

public class JumpScript : MonoBehaviour
{
    public float jumpForce = 400f; // The force of the jump
    public LayerMask groundLayer; // The layer that defines what is considered ground
    public Transform groundCheck; // A reference to a child transform to check if the character is touching the ground

    private bool isGrounded = false; // A flag to indicate if the character is touching the ground

    void Update()
    {
        // Check if the character is touching the ground
        isGrounded = Physics2D.OverlapCircle(groundCheck.position, 0.2f, groundLayer);

        // Jump if the character is touching the ground and the spacebar is pressed
        if (Input.GetKeyDown(KeyCode.Space) && isGrounded)
        {
            // Apply the jump force
            GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, jumpForce));
        }
    }
}
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence