I’m trying to make bullets spawn arround my Player and shoot in every direction … i did all the math with a sheet of paper but my script isn’t working
here it is
function SpecialAbility(radius:float){
var a: float = transform.position.x;
var b: float = transform.position.y;
for (var x:float = -radius+a; x < radius+a+0.1; x+= 0.1){
var position: Vector2;
position.x = x;
var ax: float = -2*a*x;
var bb:float = 2*b;
var numerator: float = Mathf.Pow(x,2) + ax + Mathf.Pow(a,2) + Mathf.Pow(b,2) - Mathf.Pow(radius,2);
var dinominator: float = 1 + bb;
position.y = numerator/dinominator;
Instantiate(bullet, position, Quaternion.Euler(0,0,0));
if (x != radius+a || x != -radius+a){
position.y *= -1;
Instantiate(bullet, position, Quaternion.Euler(0,0,0));
}
}
}