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);
}
}
}