Hey all,
Trying to get my projectiles to fire on a 180 degree arc every 10 degrees using sin and cos to calculate the necesary coords and taking degrees to radians into account, the bit of code i am using just seems to fire them all in one line at 0 degrees. Just wondering if anyone can see where my code is wrong.
for(Enemybullet *eb in ebulletarray){
for( float angle = 0; angle <= 180; angle = angle+10){
float x = cos(M_PI/180 * angle)*600;
float y = sin(M_PI/180 * angle)*600;
id a21 = [MoveBy actionWithDuration:3 position:ccp(x,y)];
if([eb getCanfire]){
eb.visible = YES;
eb.position = ccp(160,370);
[eb setCanfire: NO];
[eb setDead: NO];
[eb runAction: [[a21 copy]autorelease]];
}
}
}
It seems like the x and y are not changing or moveby isnt implementing the changes.
I am trying to make one of those fancy bullet patterns you get in most top down shooters.
Any ideas would be appreciated.