Trying go get bullet to fire correctly when play turns around in 2D platformer

using UnityEngine;
using System.Collections;

[RequireComponent (typeof (BulletCollision))]
public class Bullet : MonoBehaviour{

	public float bulletSpeed = 9;
	float gravity = 0;
	Vector3 velocity;

	Controller2D controller;
	BulletCollision bulletController;

	int flipNumber = 1;

	void Start () {
		bulletController = GetComponent<BulletCollision> ();
		controller = GetComponent<Controller2D> ();
	}

	void Update () {
		/*
		if (controller.collisions.faceDir != 1) {
			flipNumber = -1;
		} else {
			flipNumber = 1;
		}*/

		velocity.x = bulletSpeed * controller.collisions.faceDir;
		velocity.y += gravity * Time.deltaTime;
		bulletController.Move (velocity * Time.deltaTime);
	}
}

I need to make the bullet coming from the player to fire in the correct direction. My thought was that I need a way to reference the collisions.faceDir variable form the Collisions2d script without having to put it onto my bullet prefab. If anyone could help me with how to do this or with some other solution that would be great!

@HipsterSoap
HI!
If you use a “rigidbody2d” on the bullet, it might be simpler to achieve the results you want. You can use “Rigidbody2d.Impulse” to make the bullet fly to the correct direction( use a vector2 if the game is 2d, so you can do: right, left, up, down and diagonals easily).
To check the direction, you should use “transform.localrotation.z”
There are some good tutorials about this on a youtube channel called CasanisPlays( in a 2d game prototyping), I also learned there :slight_smile:
I hope this answer was useful.
cheers