My bullet script
/*using System.Collections;
*using System.Collections.Generic;*/
using System.Drawing;
using Unity.VisualScripting;
using UnityEngine;
public class Bullet : MonoBehaviour
{
[SerializeField] float bulletSpeed = 20f;
[SerializeField] PlayerMovement player;
Rigidbody2D bulletRigidbody;
float xSpeed;
void Start()
{
bulletRigidbody = GetComponent<Rigidbody2D>();
player = FindObjectOfType<PlayerMovement>();
xSpeed = player.transform.localScale.x * bulletSpeed;
}
void Update()
{
bulletRigidbody.velocity += new Vector2(bulletSpeed, 0f);
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Enemies"))
{
Destroy(other.gameObject);
}
Destroy(gameObject);
}
void OnCollisionEnter2D(Collision2D other)
{
Destroy(gameObject);
}
}
it won’t go to the left at all.