I making a 2d top-down shooter game and i'm currently in the process of creating weapons.

When a soldier fires a projectile, i find the unit vector between the soldiers center and mouse position ( the target )

and use that as a basis for the velocity vector for the projectile which works fine!

But i've run into problems creating a shotgun, which is supposed to spray bullets.

What i want to do here is spread 5 bullets out evenly in a 25 degree angle centered around the target vector.

My vector math is a few too many years behind me but from what i've been able to find online, the formula i need and have been using is:

xVel = xVel * (float)cos(addingAngle) - yVel * (float)sin(addingAngle); yVel = yVel * (float)sin(addingAngle) + yVel * (float)cos(addingAngle);Where xVel and yVel is the coordinates of the unit vector i found between shooter and target. addingAngle is the angle im trying to add ( or substract by being negative).

This is however, giving me some wierd results with bullets flying in irregulair angles.

I'm probably mixing up radians and degrees, but that doesnt explain why my bullets appear to be choosing such apparently random angles (however conistent)

So can anyone point me in the right direction?

I'm going to have to read up on vectors eventually, but i'd rather wait until i have more time on my hands.