random direction just in 2d

I have this script to spawn a powered up ball from a brick when hit. What I want it to do is spawn and travel in a random direction. BUT only in the X and Y axis (eg upwards, up-right, right, down-right, down, down-left…etc…) I don’t know the wording to add in: instancesuperbullet.rigidbody.AddForce(transform.down * shootforce);

Would it be …(transform.random, x, y); something like that?

thanks

var prefabsuperbullet:Transform;
var shootforce:float;

function OnCollisionEnter ( collision : Collision) {

  if (collision.collider.name == "Bullet"){
		var instancesuperbullet = Instantiate(prefabsuperbullet, transform.position, Quaternion. identity); 
		instancesuperbullet.rigidbody.AddForce(transform.down * shootforce);
	}
}

Not sure exactly what you mean by “only in the X and Y axis”, but I’ll make an educated guess.

You could try something like this:

var x = Random.Range(-1f, 1f);
var y = Random.Range(-1f, 1f);
var direction = Vector3(x, y, 0f);

//if you need the vector to have a specific length:
direction = direction.normalized * desiredLength;

var instancesuperbullet = Instantiate(prefabsuperbullet, Vector3( Random.Range(0, 2), Random.Range(0, 2), 0), Quaternion. identity);