Projectile and projectile flipping

Hey! I was wondering if any of you fine people out there could help me flip my projectile, as of right now the sword is the wrong way when i shoot to the left. I would also like to know if there is some type of delay i could between shots.

using UnityEngine;
using System.Collections;

public class swordProjectile : MonoBehaviour
{

    public float speed;


    public PlayerController player;


    public GameObject enemyDeath;
    public float fireRate = 0.5F;
    private float nextFire = 0.0F;


    // Use this for initialization
    void Start()
    {

        player = FindObjectOfType<PlayerController>();

        if (player.transform.localScale.x < 0) {
            
            speed = -speed;
     
    }

    }

    // Update is called once per frame
    void Update()
    {

        GetComponent<Rigidbody2D>().velocity = new Vector2(speed, GetComponent<Rigidbody2D>().velocity.y);

    }

    void OnTriggerEnter2D(Collider2D other)
    {

        if (other.tag == "Enemy")
        {
            Instantiate(enemyDeath, other.transform.position, other.transform.rotation);

            Destroy(other.gameObject);
        }


        Destroy(gameObject);

    }

}

Thanks!

Hey,

Normally if you google it or check the answers/questions here you find what you’re after 9/10 . If I understand your question correctly you’ll find what you’re after here: flip sprite

In short you can try the following,

private void Flip(bool horizontally)
{
    Vector3 theScale = this.transform.localScale;
    if(horizontally)
    {
        theScale.x *= -1;
        this.transform.localScale = theScale;
        return;
    }
    else
    {
        theScale.y *= -1;
        this.transform.localScale = theScale;
        return;
    }

}         

Chuck that function in your class somewhere appropriate and you might get what you’re after. Not tested it as i’m away from compiler.

Hope that helps!