10wayのソースです。
参考HPはttp://www5.big.or.jp/~high/VENIO/kouza/are08.htm
こちらの資料を参考とさせていただきました。
void enemyshot3(){
GetGraphSize( teki , &Ex , &Ey ) ; //敵画像のサイズチェック
GetGraphSize( shot2 , &ESx2 , &ESy2 ) ; //弾画像のサイズチェック
for(i=0;i<400; i++){
//サイズ、角度、スピード決定
eshotx3[i] = (Ex2 + ESx2) / 2 - ex[1];//敵サイズ+弾サイズ/2-敵座標
eshoty3[i] = (Ey2 + ESy2) / 2 - ey[1];//敵ショットのy軸
//10way弾
if(i == 0 || i % 10 == 0){ //iが0、10、20、30…なら〜
TargetX3[i] = 600 - eshotx3[i]; //目標までのxの距離を出す
TargetY3[i] = 300 - eshoty3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[i] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[i] = sin((double)Angle3[i]) * speed3;
}
if(i == 1 || i - 1 % 10 == 0){ //iが1、11、21、31…なら〜
TargetX3[i] = 550 - eshotx3[i];
TargetY3[i] = 350 - eshotx3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[i] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[i] = sin((double)Angle3[i]) * speed3;
}
if(i == 2 || i - 2 % 10 == 0){ //iが2、12、22、32…なら〜
TargetX3[i] = 500 - eshotx3[i];
TargetY3[i] = 400 - eshotx3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[i] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[i] = sin((double)Angle3[i]) * speed3;
}
if(i == 3 || i - 3 % 10 == 0){
TargetX3[i] = 450 - eshotx3[i];
TargetY3[i] = 500 - eshotx3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[i] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[i] = sin((double)Angle3[i]) * speed3;
}
if(i == 4 || i - 4 % 10 == 0){
TargetX3[i] = 400 - eshotx3[i];
TargetY3[i] = 500 - eshotx3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[i] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[i] = sin((double)Angle3[i]) * speed3;
}
if(i == 5 || i - 5 % 10 == 0){
TargetX3[i] = 350 - eshotx3[i];
TargetY3[i] = 550 - eshotx3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[i] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[i] = sin((double)Angle3[i]) * speed3;
}
if(i == 6 || i - 6 % 10 == 0){
TargetX3[i] = 300 - eshotx3[i];
TargetY3[i] = 500 - eshotx3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[i] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[i] = sin((double)Angle3[i]) * speed3;
}
if(i == 7 || i - 7 % 10 == 0){
TargetX3[i] = 200 - eshotx3[i];
TargetY3[i] = 500 - eshotx3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[i] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[i] = sin((double)Angle3[i]) * speed3;
}
if(i == 8 || i - 8 % 10 == 0){
TargetX3[i] = 100 - eshotx3[i];
TargetY3[i] = 500 - eshotx3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[i] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[i] = sin((double)Angle3[i]) * speed3;
}
if(i == 9 || i - 9 % 10 == 0){
TargetX3[i] = 0 - eshotx3[i];
TargetY3[i] = 500 - eshotx3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[9] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[9] = sin((double)Angle3[i]) * speed3;
}
if(i == 10 || i - 10 % 10 == 0){
TargetX3[i] = -10 - eshotx3[i];
TargetY3[i] = 450 - eshotx3[i];
Angle3[i] = atan2((double)TargetX3[i],(double)TargetY3[i]); //発射角度
Speedx3[i] = cos((double)Angle3[i]) * speed3; //移動量
Speedy3[i] = sin((double)Angle3[i]) * speed3;
}
if(ESFlag2[i] == 0){
ESFlag2[i] =1;
}
break;
}//for終了
for(i=0;i<400;i++){
if(ESFlag2[i]==1){ //弾のフラグがたってるなら
//移動処理
eshotx3[i]+=Speedx3[i]; //弾の移動x
eshoty3[i]+=Speedy3[i]; //弾の移動y
if(eshoty3[i] > 500 || eshotx3[i] < -10 || eshotx3[i] > 510){ //弾が画面外に出たら
ESFlag2[i] = 0;
}
DrawGraph(eshotx3[i],eshoty3[i],shot2,FALSE);
}
}
}