Mario-Like 2D platformer (Bill Blaster)

I’m doing a school project to make a game like super mario bros on unity3d using design patterns, and i’m making the bill blaster. i already made it instantiate the bill bullets but i don’t know how do i make the bullet blaster detect on which side is the player so it will shot the bullets that way.

this is what i’ve done so far

public class Bill_Blaster_Demo : MonoBehaviour {
    public Transform BB_Spwan; // Where the bullet gets instantiated from
    public EnemyManager em;
    public GameObject bb; //the Bullet Bill
    float spawnWait = 2.5f;
    float destroyWait = 10f;
    IEnemies Bill_blaster;
    

	void Start ()
    {
        Bill_blaster = em.GetEnemy(gameObject.tag);
        Bill_Blaster.setTransform(BB_Spwan);
        StartCoroutine(Spawn());
	}
	
    IEnumerator Spawn()
    {
        while (true)
        {
            Bill_blaster.Move(bb);
            yield return new WaitForSeconds(spawnWait);
            
        }
    }
}

Have you tried comparing the position.x of the player with the position.x of the bill blaster? You could add an if statement that checks for this in the Spawn() method.

It sounds like unity’s demo for a jumpman shooter at

Unity Asset Store - The Best Assets for Game Making

You could either look at their code, or change their code to fit your needs. There isn’t a demo for this so you might want to look at the much more complicated unity demo that has a tutorial here:

tutorial: