task Stage5
{
	StageProgress=5;
	CreateEnemyFromFile(csd~"stage5/LoadEnemy.txt",0,0,0,0,0);
	DeleteMusic(BGM[8]);
	PlayMusic(BGM[9]);
	wait(180);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy01.txt",GetCenterX-120,GetClipMinY,1,90,-1);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy01.txt",GetCenterX+120,GetClipMinY,1,90,1);
	wait(90);
	Stage5Unit1(4);
	wait(90);
	Stage5Unit2(4);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy01.txt",GetCenterX-100,GetClipMinY,1,90,-1);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy01.txt",GetCenterX+100,GetClipMinY,1,90,1);
	wait(180);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy01.txt",GetCenterX-80,GetClipMinY,1,90,-1);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy01.txt",GetCenterX+80,GetClipMinY,1,90,1);
	wait(180);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy01.txt",GetCenterX-60,GetClipMinY,1,90,-1);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy01.txt",GetCenterX+60,GetClipMinY,1,90,1);
	wait(180);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy01.txt",GetCenterX-40,GetClipMinY,1,90,-1);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy01.txt",GetCenterX+40,GetClipMinY,1,90,1);
	wait(300);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy03.txt",GetCenterX-80,GetClipMinY,1,90,1);
	wait(240);
	Stage5Unit3;
	wait(120);
	Stage5Unit1(6);
	wait(90);
	Stage5Unit2(6);
	wait(240);
	Stage5Unit4;
	wait(900);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy07.txt",GetCenterX-80,GetClipMinY,1,90,1);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy07.txt",GetCenterX+80,GetClipMinY,1,90,-1);
	wait(900);
	DeleteAllEnemyWithoutBoss;
	DeleteEnemyShotToItemInCircle(ALL,GetCenterX,GetCenterY,300);	
			alternative(SelectedDifficult)
			case("Easy")
			{
				CreateEnemyBossFromFile(csd~"stage5/Stage5MidBossEasy.txt",GetCenterX-60,GetClipMinY,2,0,0);
			}
			case("Normal")
			{
				CreateEnemyBossFromFile(csd~"stage5/Stage5MidBossNormal.txt",GetCenterX-60,GetClipMinY,2,0,0);
			}
			case("Hard")
			{
				CreateEnemyBossFromFile(csd~"stage5/Stage5MidBossHard.txt",GetCenterX-60,GetClipMinY,2,0,0);
			}
			case("Lunatic")
			{
				CreateEnemyBossFromFile(csd~"stage5/Stage5MidBossLunatic.txt",GetCenterX-60,GetClipMinY,2,0,0);
			}
			case("Extra")
			{
				CreateEnemyBossFromFile(csd~"stage5/Stage5MidBossExtra.txt",GetCenterX-60,GetClipMinY,2,0,0);
			}
			WaitForZeroEnemy();
			wait(120);
	Stage5Unit7;
	wait(900);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy09.txt",GetCenterX+80,GetClipMinY,1,90,1);
	wait(180);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy09.txt",GetCenterX-80,GetClipMinY,1,90,1);
	wait(240);
	Stage5Unit8;
	wait(120);
	Stage5Unit9;
	wait(120);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy10.txt",GetCenterX,GetClipMinY,1,90,1);
	WaitForZeroEnemy();
	wait(120);
	Stage5Unit10;
	Stage5Unit11;
	wait(1480);
//	DeleteAllEnemyWithoutBoss;
//	DeleteEnemyShotToItemInCircle(ALL,GetCenterX,GetCenterY,300);
	wait(60);
	DeleteMusic(BGM[9]);
	PlayMusic(BGM[10]);
	CreateEnemyFromFile(csd~"stage5/DeleteEnemy.txt",0,0,0,0,0);
			alternative(SelectedDifficult)
			case("Easy")
			{
				CreateEnemyBossFromFile(csd~"stage5/Stage5BossEasy.txt",GetCenterX+60,GetClipMinY,2,0,0);
			}
			case("Normal")
			{
				CreateEnemyBossFromFile(csd~"stage5/Stage5BossNormal.txt",GetCenterX+60,GetClipMinY,2,0,0);
			}
			case("Hard")
			{
				CreateEnemyBossFromFile(csd~"stage5/Stage5BossHard.txt",GetCenterX+60,GetClipMinY,2,0,0);
			}
			case("Lunatic")
			{
				CreateEnemyBossFromFile(csd~"stage5/Stage5BossLunatic.txt",GetCenterX+60,GetClipMinY,2,0,0);
			}
			case("Extra")
			{
				CreateEnemyBossFromFile(csd~"stage5/Stage5BossExtra.txt",GetCenterX+60,GetClipMinY,2,0,0);
			}
	WaitForZeroEnemy();
	StageProgress=6;
}

task Stage5Unit1(num)
{
loop(num)
{
	ascent(let i in 0..5)
	{
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy02.txt",GetCenterX+80,GetClipMinY,4,90,1);
		wait(10);
	}
wait(150);
}
}


task Stage5Unit2(num)
{
loop(num)
{
	ascent(let i in 0..5)
	{
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy02.txt",GetCenterX-80,GetClipMinY,4,90,2);
		wait(10);
	}
wait(150);
}
}

task Stage5Unit3
{
	ascent(let i in 0..5)
	{
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy04.txt",GetCenterX+20+30*i,GetClipMinY,1,-90,2);
		wait(20);
	}
}

task Stage5Unit4
{
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy05.txt",GetCenterX+120,GetClipMinY,1,-90,2);
		wait(180);
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy05.txt",GetCenterX+80,GetClipMinY,1,-90,2);
		wait(180);
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy05.txt",GetCenterX+40,GetClipMinY,1,-90,2);
		wait(180);
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy05.txt",GetCenterX+80,GetClipMinY,1,-90,2);
		wait(180);
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy05.txt",GetCenterX+120,GetClipMinY,1,-90,2);
		wait(180);
}

task Stage5Unit5
{
	loop(4)
	{
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy06.txt",GetClipMaxX,GetCenterY-40,3,180,2);
		wait(90);
	}
}

task Stage5Unit6
{
	loop(4)
	{
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy06.txt",GetClipMinX,GetCenterY-80,3,0,2);
		wait(90);
	}
}

task Stage5Unit7
{
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX+100,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX+50,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX+0,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX-50,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX-100,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX-50,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX-0,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX+50,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX-0,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX-50,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy08.txt",GetCenterX-100,GetClipMinY,1,90,1);
}

task Stage5Unit8
{
	ascent(let i in 0..10)
	{
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy04.txt",GetCenterX+120-20*i,GetClipMinY,1,-90,2);
		wait(10);
	}
}

task Stage5Unit9
{
	ascent(let i in 0..10)
	{
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy04.txt",GetCenterX-120+20*i,GetClipMinY,1,-90,2);
		wait(10);
	}
}


task Stage5Unit10
{
	loop(2)
	{
	ascent(let i in 0..9)
	{
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy11.txt",GetCenterX-160+40*i,GetClipMinY,3,-90,2);
		wait(30);
	}
	ascent(let i in 0..9)
	{
		CreateEnemyFromFile(csd~"stage5/Stage5Enemy11.txt",GetCenterX+160-40*i,GetClipMinY,3,-90,2);
		wait(30);
	}
	}
}

task Stage5Unit11
{
	loop(5)
	{
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy12.txt",GetCenterX+100,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy12.txt",GetCenterX+0,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy12.txt",GetCenterX-100,GetClipMinY,1,90,1);
	wait(60);
	CreateEnemyFromFile(csd~"stage5/Stage5Enemy12.txt",GetCenterX-0,GetClipMinY,1,90,1);
	wait(60);
	}
}