I wanna make some bullets fire out of a dude at specific angles (refer to diagram) in a series that makes it like a double radar thingie.
This is the code I wrote:
if SPAWN_BULLETS = True then begin
if BULLET_COUNTER = 4 then
BULLET_COUNTER:= 1;
else
BULLET_COUNTER:= BULLET_COUNTER + 1;
CreateBullet(GetPlayerStat(BOT_CHALLENGER,'x'), GetPlayerStat(BOT_CHALLENGER,'y'),20*sin((BULLET_COUNTER*45)+5),20*cos((BULLET_COUNTER*45)+5),0, 1,BOT_CHALLENGER);
CreateBullet(GetPlayerStat(BOT_CHALLENGER,'x'), GetPlayerStat(BOT_CHALLENGER,'y'),20*sin((BULLET_COUNTER*45)+395),20*cos((BULLET_COUNTER*45)+395),0, 1,BOT_CHALLENGER);
CreateBullet(GetPlayerStat(BOT_CHALLENGER,'x'), GetPlayerStat(BOT_CHALLENGER,'y'),20*sin((BULLET_COUNTER*45)+175),20*cos((BULLET_COUNTER*45)+175),0, 1,BOT_CHALLENGER);
CreateBullet(GetPlayerStat(BOT_CHALLENGER,'x'), GetPlayerStat(BOT_CHALLENGER,'y'),20*sin((BULLET_COUNTER*45)+185),20*cos((BULLET_COUNTER*6.28*45)+185),0, 1,BOT_CHALLENGER);
end;
The only thing I need help with is the conversion from polar(velocity,angle) to rectangular(X velocity,Y velocity)
The bullets come out really effed up, so some help would be appreciated.
(If you aren't sure what all the variables are, just ask and I will explain them (I think they are fairly obvious))
EDIT: I should probably said that it isn't coming out right, like 3 bullets on the left and one up lol.