task Stage2
{
			StageProgress=2;
			CreateEnemyFromFile(csd~"stage2/LoadEnemy.txt",0,0,0,0,0);
			PlayMusic(BGM[3]);
			wait(180);

			Stage2Unit1(GetClipMinX,GetClipMinY+64,0,1);
			wait(120);
			Stage2Unit1(GetClipMaxX,GetClipMinY+64,180,2);
			wait(120);
			Stage2Unit1(GetClipMaxX,GetClipMaxY-64,180,1);
			wait(120);
			Stage2Unit1(GetClipMinX,GetClipMaxY-64,0,2);
			wait(120);
			Stage2Unit1(GetClipMinX,GetClipMinY+64,0,1);
			Stage2Unit1(GetClipMaxX,GetClipMinY+64,180,2);
			Stage2Unit1(GetClipMaxX,GetClipMaxY-64,180,1);
			Stage2Unit1(GetClipMinX,GetClipMaxY-64,0,2);
			wait(360);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX,GetClipMinY,4,90,2);
			wait(60);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX+80,GetClipMinY,4,90,2);
			wait(60);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX-80,GetClipMinY,4,90,2);
			wait(60);
			Stage2Unit1(GetClipMinX,GetClipMinY+64,0,1);
			wait(60);
			Stage2Unit1(GetClipMaxX,GetClipMinY+64,180,2);
			wait(60);
			Stage2Unit1(GetClipMinX,GetClipMinY+64,0,1);
			wait(60);
			Stage2Unit1(GetClipMaxX,GetClipMinY+64,180,2);
			wait(120);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX,GetClipMinY,4,90,2);
			wait(30);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX-30,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX+30,GetClipMinY,4,90,2);
			wait(30);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX-60,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX+60,GetClipMinY,4,90,2);
			wait(120);
			Stage2Unit1(GetClipMaxX,GetClipMaxY-64,180,1);
			Stage2Unit1(GetClipMinX,GetClipMaxY-64,0,2);
			wait(360);
			DeleteEnemyShotToItemInCircle(ALL,GetCenterX,GetCenterY,300);
			alternative(SelectedDifficult)
			case("Easy")
			{
				CreateEnemyBossFromFile(csd~"stage2/Stage2MidBossEasy.txt",GetClipMinX,GetCenterY+60,2,0,0);
			}
			case("Normal")
			{
				CreateEnemyBossFromFile(csd~"stage2/Stage2MidBossNormal.txt",GetClipMinX,GetCenterY+60,2,0,0);
			}
			case("Hard")
			{
				CreateEnemyBossFromFile(csd~"stage2/Stage2MidBossHard.txt",GetClipMinX,GetCenterY+60,2,0,0);
			}
			case("Lunatic")
			{
				CreateEnemyBossFromFile(csd~"stage2/Stage2MidBossLunatic.txt",GetClipMinX,GetCenterY+60,2,0,0);
			}
			WaitForZeroEnemy();			
			wait(150);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX-30,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX+30,GetClipMinY,4,90,2);
			wait(180);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy04.txt",GetCenterX-80,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy04.txt",GetCenterX+80,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy04.txt",GetCenterX-120,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy04.txt",GetCenterX+120,GetClipMinY,4,90,2);
			wait(120);
			Stage2Unit1(GetClipMinX,GetClipMinY+64,0,1);
			wait(120);
			Stage2Unit1(GetClipMaxX,GetClipMinY+64,180,2);
			wait(120);
			Stage2Unit1(GetClipMaxX,GetClipMaxY-64,180,1);
			wait(120);
			Stage2Unit1(GetClipMinX,GetClipMaxY-64,0,2);
			wait(120);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX-120,GetClipMinY,4,90,2);
			wait(30);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy04.txt",GetCenterX+80,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy04.txt",GetCenterX+120,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy04.txt",GetCenterX+160,GetClipMinY,4,90,2);
			wait(180);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy03.txt",GetCenterX+120,GetClipMinY,4,90,2);
			wait(30);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy04.txt",GetCenterX-80,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy04.txt",GetCenterX-120,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy04.txt",GetCenterX-160,GetClipMinY,4,90,2);
			wait(360);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy02.txt",GetCenterX,GetClipMinY,4,90,2);
			wait(180);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy02.txt",GetCenterX+120,GetClipMinY,4,90,2);
			wait(180);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy02.txt",GetCenterX-120,GetClipMinY,4,90,2);
			wait(180);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy02.txt",GetCenterX+80,GetClipMinY,4,90,2);
			CreateEnemyFromFile(csd~"stage2/Stage2Enemy02.txt",GetCenterX-80,GetClipMinY,4,90,2);
			wait(600);
			PlayMusic(BGM[4]);
			CreateEnemyFromFile(csd~"stage2/DeleteEnemy.txt",0,0,0,0,0);
			DeleteEnemyShotToItemInCircle(ALL,GetCenterX,GetCenterY,300);
			alternative(SelectedDifficult)
			case("Easy")
			{
				CreateEnemyBossFromFile(csd~"stage2/Stage2BossEasy.txt",GetClipMinX-30+rand(-20,20),rand(30,150),2,0,0);
			}
			case("Normal")
			{
				CreateEnemyBossFromFile(csd~"stage2/Stage2BossNormal.txt",GetClipMinX-30+rand(-20,20),rand(30,150),2,0,0);
			}
			case("Hard")
			{
				CreateEnemyBossFromFile(csd~"stage2/Stage2BossHard.txt",GetClipMinX,rand(30,150),2,0,0);
			}
			case("Lunatic")
			{
				CreateEnemyBossFromFile(csd~"stage2/Stage2BossLunatic.txt",GetClipMinX-30+rand(-20,20),rand(30,150),2,0,0);
			}
			WaitForZeroEnemy();
			wait(60);
			StageProgress=3;
}

task Stage2Unit1(x,y,angle,num)
{
	loop(5)
	{
	CreateEnemyFromFile(csd~"stage2/Stage2Enemy01.txt",x,y,4,angle,num);
	wait(20);
	}
}
