task Stage3
{
			StageProgress=3;
			CreateEnemyFromFile(csd~"stage3/LoadEnemy.txt",0,0,0,0,0);
			DeleteMusic(BGM[4]);
			PlayMusic(BGM[5]);
			wait(180);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy01.txt",GetCenterX,GetClipMinY,4,90,2);
			wait(420);
			Stage3Unit1(GetCenterX+120,GetClipMinY,90,1);
			wait(90);
			Stage3Unit1(GetCenterX-120,GetClipMinY,90,2);
			wait(90);
			Stage3Unit1(GetCenterX+120,GetClipMaxY,-90,2);
			wait(90);
			Stage3Unit1(GetCenterX-120,GetClipMaxY,-90,1);
			wait(300);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy03.txt",GetCenterX-64,GetClipMinY+64,0,0,0);
			wait(120);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy04.txt",GetCenterX+64,GetClipMinY+96,0,0,0);
			wait(120);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy03.txt",GetCenterX+96,GetClipMinY+96,0,0,0);
			wait(100);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy04.txt",GetCenterX-64,GetClipMinY+64,0,0,0);
			wait(100);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy03.txt",GetCenterX+32,GetClipMinY+96,0,0,0);
			wait(80);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy04.txt",GetCenterX-128,GetClipMinY+64,0,0,0);
			wait(80);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy03.txt",GetCenterX+128,GetClipMinY+48,0,0,0);
			wait(60);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy04.txt",GetCenterX-32,GetClipMinY+128,0,0,0);
			wait(60);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy03.txt",GetCenterX+64,GetClipMinY+32,0,0,0);
			wait(40);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy04.txt",GetCenterX-96,GetClipMinY+64,0,0,0);
			wait(40);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy03.txt",GetCenterX+128,GetClipMinY+32,0,0,0);
			wait(20);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy04.txt",GetCenterX-128,GetClipMinY+32,0,0,0);
			wait(20);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy03.txt",GetCenterX+64,GetClipMinY+128,0,0,0);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy04.txt",GetCenterX-64,GetClipMinY+128,0,0,0);
		//	WaitForZeroEnemy();
			wait(600);
			DeleteEnemyShotToItemInCircle(ALL,GetCenterX,GetCenterY,300);
			alternative(SelectedDifficult)
			case("Easy")
			{
				CreateEnemyBossFromFile(csd~"stage3/Stage3MidBossEasy.txt",GetCenterX-60,GetClipMinY,2,0,0);
			}
			case("Normal")
			{
				CreateEnemyBossFromFile(csd~"stage3/Stage3MidBossNormal.txt",GetCenterX-60,GetClipMinY,2,0,0);
			}
			case("Hard")
			{
				CreateEnemyBossFromFile(csd~"stage3/Stage3MidBossHard.txt",GetCenterX-60,GetClipMinY,2,0,0);
			}
			case("Lunatic")
			{
				CreateEnemyBossFromFile(csd~"stage3/Stage3MidBossLunatic.txt",GetCenterX-60,GetClipMinY,2,0,0);
			}
			case("Extra")
			{
				CreateEnemyBossFromFile(csd~"stage3/Stage3MidBossExtra.txt",GetCenterX-60,GetClipMinY,2,0,0);
			}
			WaitForZeroEnemy();
			wait(60);
			Stage3Unit1(GetCenterX-120,GetClipMaxY,-90,1);
			wait(90);
			Stage3Unit1(GetCenterX+120,GetClipMaxY,-90,2);
			wait(90);
			Stage3Unit1(GetCenterX-120,GetClipMinY,90,2);
			wait(90);
			Stage3Unit1(GetCenterX+120,GetClipMinY,90,1);
			wait(210);
			Stage3Unit2(1);
			wait(90);
			Stage3Unit3(2);
			wait(90);
			Stage3Unit2(1);
			wait(90);
			Stage3Unit3(2);
			wait(120);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy06.txt",GetCenterX+32,GetClipMinY,2,90,1);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy06.txt",GetCenterX-32,GetClipMinY,2,90,1);
			wait(120);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy06.txt",GetCenterX+64,GetClipMinY,2,90,1);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy06.txt",GetCenterX-64,GetClipMinY,2,90,1);
			Stage3Unit2(1);
			wait(120);
			Stage3Unit3(2);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy06.txt",GetCenterX+96,GetClipMinY,2,90,1);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy06.txt",GetCenterX-96,GetClipMinY,2,90,1);
			wait(120);
			Stage3Unit2(1);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy06.txt",GetCenterX+128,GetClipMinY,2,90,1);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy06.txt",GetCenterX-128,GetClipMinY,2,90,1);
			wait(120);
			Stage3Unit3(2);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy06.txt",GetCenterX,GetClipMinY,2,90,1);
			wait(360);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy01.txt",GetCenterX,GetClipMinY,4,90,2);
			wait(60);
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy07.txt",GetCenterX+64,GetClipMinY,4,90,2);		
			CreateEnemyFromFile(csd~"stage3/Stage3Enemy07.txt",GetCenterX-64,GetClipMinY,4,90,2);		
			wait(600);
			DeleteMusic(BGM[5]);
			PlayMusic(BGM[6]);
			CreateEnemyFromFile(csd~"stage3/DeleteEnemy.txt",0,0,0,0,0);
			DeleteEnemyShotToItemInCircle(ALL,GetCenterX,GetCenterY,300);
			alternative(SelectedDifficult)
			case("Easy")
			{
				CreateEnemyBossFromFile(csd~"stage3/Stage3BossEasy.txt",GetCenterX+60,GetClipMinY,2,0,0);
			}
			case("Normal")
			{
				CreateEnemyBossFromFile(csd~"stage3/Stage3BossNormal.txt",GetCenterX+60,GetClipMinY,2,0,0);
			}
			case("Hard")
			{
				CreateEnemyBossFromFile(csd~"stage3/Stage3BossHard.txt",GetCenterX+60,GetClipMinY,2,0,0);
			}
			case("Lunatic")
			{
				CreateEnemyBossFromFile(csd~"stage3/Stage3BossLunatic.txt",GetCenterX+60,GetClipMinY,2,0,0);
			}
			case("Extra")
			{
				CreateEnemyBossFromFile(csd~"stage3/Stage3BossExtra.txt",GetCenterX+60,GetClipMinY,2,0,0);
			}
			WaitForZeroEnemy();
			wait(300);
			StageProgress=4;
}

task Stage3Unit1(x,y,angle,dir)
{
loop(5)
{
	CreateEnemyFromFile(csd~"stage3/Stage3Enemy02.txt",x,y,2,angle,dir);
	wait(20);
}
}


task Stage3Unit2(num)
{
ascent(let i in 0..5)
{
	CreateEnemyFromFile(csd~"stage3/Stage3Enemy05.txt",GetClipMinX,GetClipMinY+100+i*20,2.5,0,num);
	wait(40);
}
}

task Stage3Unit3(num)
{
ascent(let i in 0..5)
{
	CreateEnemyFromFile(csd~"stage3/Stage3Enemy05.txt",GetClipMaxX,GetClipMinY+100+i*20,2.5,180,num);
	wait(40);
}
}