task TAKOO{  

                      let gokusi=49;
                      let aaaaa=0;
   
		let cx=GetCenterX();


			function Wait(let frame)
			{//待機関数
				loop(frame){yield};
			}
			function WaitForZeroEnemy()
			{//敵数が0になるまで待機する関数
				while(GetEnemyNum() != 0){yield;}
			}
yield;

Wait(60);
if(GetCommonDataEx("gokusi",myu)==1){PlayMusic("\bgm\x4introx.mid");}
if(GetCommonDataEx("gokusi",myu)==2){PlayMusic("\bgm\zerox4.mid");}
Wait(360);




             loop(2){let a=rand(-90,90);
                     Wait(60);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO03.TXT",GetCenterX+a,GetClipMinY,0,0,0);
                     Wait(120);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO03.TXT",GetCenterX+90+a,GetClipMinY,0,0,0);
                        CreateEnemyFromFile("script\某タコ\TAKOZAKO03.TXT",GetCenterX-90+a,GetClipMinY,0,0,0);
                     Wait(120);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO035.TXT",GetCenterX+a,GetClipMinY,0,0,0);
                   Wait(90);
}
WaitForZeroEnemy();
 Wait(60);
loop(2){
             loop(1){let a=rand(0,60);
                     Wait(60);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO01.TXT",GetClipMinX+a,GetClipMaxY,0,0,0);
                       Wait(30);
                        CreateEnemyFromFile("script\某タコ\TAKOZAKO01.TXT",GetClipMinX+a,GetClipMaxY,0,0,0);
                       Wait(30);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO01.TXT",GetClipMinX+a,GetClipMaxY,0,0,0);
                       Wait(30);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO01.TXT",GetClipMinX+a,GetClipMaxY,0,0,0);
                   Wait(120);
}

             loop(1){let a=rand(0,60);
                     Wait(60);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO02.TXT",GetClipMaxX-a,GetClipMaxY,0,0,0);
                       Wait(30);
                        CreateEnemyFromFile("script\某タコ\TAKOZAKO02.TXT",GetClipMaxX-a,GetClipMaxY,0,0,0);
                       Wait(30);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO02.TXT",GetClipMaxX-a,GetClipMaxY,0,0,0);
                       Wait(30);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO02.TXT",GetClipMaxX-a,GetClipMaxY,0,0,0);
                   Wait(120);
}

}
       Wait(360);
CreateEnemyBossFromFile("script\某タコ\TAKOZAKO04.TXT",GetCenterX,GetClipMinY,0,0,0);
WaitForZeroEnemy();

loop(3){
let a=30;
             loop(8){
                     Wait(30);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO03a.TXT",GetClipMinX+a,GetClipMinY,0,0,0);
a=a+45
}
 Wait(60);
}
WaitForZeroEnemy();
 Wait(60);
loop(3){
             loop(1){let a=rand(0,60);
                     Wait(60);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO01.TXT",GetClipMinX+a,GetClipMaxY,0,0,0);
                       Wait(30);
                        CreateEnemyFromFile("script\某タコ\TAKOZAKO01.TXT",GetClipMinX+a,GetClipMaxY,0,0,0);
                       Wait(30);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO01.TXT",GetClipMinX+a,GetClipMaxY,0,0,0);
                       Wait(30);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO01.TXT",GetClipMinX+a,GetClipMaxY,0,0,0);
                   Wait(120);
}
             loop(1){let a=rand(0,60);
                     Wait(60);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO02.TXT",GetClipMaxX-a,GetClipMaxY,0,0,0);
                       Wait(30);
                        CreateEnemyFromFile("script\某タコ\TAKOZAKO02.TXT",GetClipMaxX-a,GetClipMaxY,0,0,0);
                       Wait(30);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO02.TXT",GetClipMaxX-a,GetClipMaxY,0,0,0);
                       Wait(30);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO02.TXT",GetClipMaxX-a,GetClipMaxY,0,0,0);
                   Wait(120);
}

}
       Wait(360);
CreateEnemyBossFromFile("script\某タコ\TAKOZAKO04.TXT",GetCenterX,GetClipMinY,0,0,0);
WaitForZeroEnemy();

loop(8){
             loop(1){let a=rand(0,60);
                     Wait(60);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO01.TXT",GetClipMinX+a,GetClipMaxY,0,0,0);
			CreateEnemyFromFile("script\某タコ\TAKOZAKO02.TXT",GetClipMaxX-a,GetClipMaxY,0,0,0);
                       Wait(60);
}

}
WaitForZeroEnemy();
loop(1){
let L=30;
let A=30;
         loop(6){
			CreateEnemyFromFile("script\某タコ\TAKOZAKO10a.TXT",GetClipMaxX-A,GetClipMinY,0,0,L);
      L=L+10;
        A=A+60;
}
Wait(30);
   L=L-30;
A=60;
         loop(6){
			CreateEnemyFromFile("script\某タコ\TAKOZAKO10b.TXT",GetClipMinX,GetClipMinY+A,0,0,L);
    L=L+10;
        A=A+60;
}
A=30;
Wait(30);
 L=L-30;
         loop(6){
			CreateEnemyFromFile("script\某タコ\TAKOZAKO10c.TXT",GetClipMinX+A,GetClipMaxY,0,0,L);
    L=L+10;
        A=A+60;
}
A=60;
Wait(30);
   L=L-30;
         loop(6){
			CreateEnemyFromFile("script\某タコ\TAKOZAKO10d.TXT",GetClipMaxX,GetClipMaxY-A,0,0,L);
      L=L+10;
        A=A+60;
}
WaitForZeroEnemy();

}

WaitForZeroEnemy();
 Wait(60);
CreateEnemyBossFromFile("script\某タコ\TAKOZAKO05.TXT",GetCenterX,GetClipMinY,0,0,0);
WaitForZeroEnemy();
ExtendPlayer(1);
AddBomb(30);
CreateEnemyBossFromFile("script\某タコ\BOSSタコ.TXT",GetCenterX,GetClipMinY,0,0,0);
WaitForZeroEnemy();
DeleteEnemyShot(ALL);
  CreateEventFromScript("OCf");
loop{yield;  if(OnEvent()==false){break;}}
                SetCommonDataEx("gokusi",OC,1);  
CreateEventFromScript("Get");
loop{yield;   if(OnEvent()==false){break;}}
if(GetCommonDataEx("gokusi",ST)+GetCommonDataEx("gokusi",FA)+GetCommonDataEx("gokusi",CM)+GetCommonDataEx("gokusi",OC)+GetCommonDataEx("gokusi",BM)+GetCommonDataEx("gokusi",IC)+GetCommonDataEx("gokusi",EL)+GetCommonDataEx("gokusi",AM)==4){
WaitForZeroEnemy();
ExtendPlayer(1);
AddBomb(30);
Wait(300);
if(GetCommonDataEx("gokusi",50)==1){
CreateEnemyBossFromFile("script\vava\BOSSVAVA1.TXT",GetCenterX,GetClipMinY,0,0,0);
WaitForZeroEnemy();
CreateEventFromScript("VAf");
loop{yield;  if(OnEvent()==false){break;}}
}
else{
CreateEnemyBossFromFile("script\某犬\BOSS狼a.TXT",GetCenterX,GetClipMinY,0,0,0);
WaitForZeroEnemy();
CreateEventFromScript("BELaf");
loop{yield;   if(OnEvent()==false){break;}}
}

}
WaitForZeroEnemy();
PlayMusic("\bgm\BattleFinish.mid");
Wait(1220);
SetCommonDataEx("gokusi",TEST,0); 
PlayMusic("\bgm\DrCain.mid");
if(GetCommonDataEx("gokusi",ST)+GetCommonDataEx("gokusi",FA)+GetCommonDataEx("gokusi",CM)+GetCommonDataEx("gokusi",OC)+GetCommonDataEx("gokusi",BM)+GetCommonDataEx("gokusi",IC)+GetCommonDataEx("gokusi",EL)+GetCommonDataEx("gokusi",AM)==4){
CreateEventFromScript("MID");
loop{yield;   if(OnEvent()==false){break;}}
}
if(GetCommonDataEx("gokusi",ST)+GetCommonDataEx("gokusi",FA)+GetCommonDataEx("gokusi",CM)+GetCommonDataEx("gokusi",OC)+GetCommonDataEx("gokusi",BM)+GetCommonDataEx("gokusi",IC)+GetCommonDataEx("gokusi",EL)+GetCommonDataEx("gokusi",AM)==8){
CreateEventFromScript("FINAL");
loop{yield;   if(OnEvent()==false){break;}}
}
ExtendPlayer(1);
AddBomb(-1*GetPlayerBomb);
AddBomb(100);
    



}
