It doesn't flip the bullet

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.

Hi,

What’s the difference between bulletSpeed and xSpeed?

I just mistakenly pressed undo on the key board but then i noticed something in my script changed but i coulnt notice the xSpeed and bulletSpeed.Finally solved

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms