Untitled

 avatar
unknown
plain_text
2 months ago
433 B
1
Indexable
using UnityEngine;

public class BallKick : MonoBehaviour
{
    public Rigidbody2D ball;
    public float kickPower = 10f;

    void Update()
    {
        if (Input.GetMouseButtonDown(0)) // کلک پر کک کریں
        {
            Vector2 direction = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
            ball.AddForce(direction.normalized * kickPower, ForceMode2D.Impulse);
        }
    }
}
Leave a Comment