Unity-C#

 2024.07.07 unityC#  
 2024.05.15 unityC#  
 2024.05.15 unityC#  
 2022.11.06 unityC#  
 2022.11.06 unityC#  
 2022.11.06 unityC#  
 2022.11.06 unityC#  
 2022.11.06 unityC#  
 2022.08.16 spritekit  

Bullet


public class Bullet : MonoBehaviour
{
    Rigidbody2D  rbody; 
     public float speed;   
    void Start()
    {
      rbody = this.GetComponent();
     //  playerRb = GameObject.Find("Player").GetComponent();
    }
     void FixedUpdate()
    {
        rbody.velocity = new Vector2(speed, 0);    
    }
    void Update()
    {
    //   rbody.velocity = new Vector2(speed, 0);
     //  transform.position += new Vector3(-15f * Time.deltaTime, 0, 0);
     //  transform.Rotate(0f, 180f, 0f);
     //    transform.position += new Vector3(15f * Time.deltaTime, 0,  0);
     if(transform.position.x > 20.0f )
        {    
             Destroy(gameObject);
         }
      }
    }