sub Stage1
{
			DeleteMusic(BGM[0]);
			PlayMusic(BGM[1]);
			CreateEnemyFromFile(csd~"stage1/LoadEnemy.txt",0,0,0,0,0);
			wait(120);
	if(StagePhaseProgress==0)
	{
			wait(60);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMaxX+16,GetCenterY-128,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMaxX+16,GetCenterY-128,2,90,1);
			wait(60);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMinX+16,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMinX+32,GetClipMinY-16,2,90,1);
			wait(15);
			Stage1Unit1;
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMinX+48,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMinX+64,GetClipMinY-16,2,90,1);
			wait(90);
			Stage1Unit2;
			wait(60);
			Stage1Unit3;
			wait(60);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy03.txt",GetClipMinX-64,GetCenterY-96,2,90,1);
			wait(240);
			Stage1Unit4;
			wait(120);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy03.txt",GetClipMaxX+64,GetCenterY-96,2,90,-1);
			wait(120);

			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMinX+64,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMinX+48,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMinX+32,GetClipMinY-16,2,90,1);
			wait(30);

			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMaxX-120,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMaxX-100,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMaxX-80,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMaxX-60,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMaxX-40,GetClipMinY-16,2,90,1);
			wait(50);
			Stage1Unit5;
			wait(130);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy06a.txt",GetClipMinX+60,GetClipMinY-76,1,90,1);
			wait(180);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy09.txt",GetClipMinX+30,GetClipMinY-16,1,90,1);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy09.txt",GetClipMinX+100,GetClipMinY-16,1,90,1);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy09.txt",GetClipMinX+170,GetClipMinY-16,1,90,1);
			wait(60);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMaxX-150,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMaxX-100,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMaxX-50,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMaxX-125,GetClipMinY-16,2,90,1);
			wait(15);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMaxX-75,GetClipMinY-16,2,90,1);
			wait(30);
			Stage1Unit16;
			wait(60);
			Stage1Unit6;
			wait(100);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy06b.txt",GetClipMaxX-60,GetClipMinY-76,1,90,1);
			wait(240);
			Stage1Unit5;
			wait(60);
			Stage1Unit7;
			wait(480);
	}
///////////////////////////////////////////////////////////////////
	if(StagePhaseProgress<=1)
	{
			SetCommonData("STAGE1MIDBOSS",true);
			CreateEnemyBossFromFile(csd~"stage1/Stage1MidBoss.txt",GetClipMaxX-60,GetClipMinY-16,2,0,0);

			WaitForZeroEnemy;
			SetCommonData("STAGE1MIDBOSS",false);
			BGStage1MidBossEnd;
	}
	if(StagePhaseProgress<=2)
	{
			wait(30);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy07.txt",GetCenterX-100,GetClipMinY-16,1,90,1);
			wait(60);
			Stage1Unit8;
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy07.txt",GetCenterX+100,GetClipMinY-16,1,90,1);
			Stage1Unit9;
			wait(30);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy08.txt",GetCenterX+16,GetClipMinY-64,0.5,90,1);
			wait(30);
			wait(240);
			Stage1Unit11;
			wait(90);
			Stage1Unit12;
			wait(90);
			wait(60);
			Stage1Unit13;
			wait(90);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy07.txt",GetCenterX-80,GetClipMinY-16,1,90,1);
			wait(60);
			Stage1Unit12;
			wait(90);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy07.txt",GetCenterX+80,GetClipMinY-16,1,90,1);
			wait(60);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy07.txt",GetCenterX,GetClipMinY-16,1,90,1);
			wait(30);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy07.txt",GetCenterX-80,GetClipMinY-16,1,90,1);
			wait(90);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy06a.txt",GetCenterX-100,GetClipMinY-76,1,90,1);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy06b.txt",GetCenterX+100,GetClipMinY-76,1,90,1);
			wait(360);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy03.txt",GetClipMaxX+64,GetCenterY-96,2,90,-1);
			wait(120);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy03.txt",GetClipMinX-64,GetCenterY-96,2,90,1);
			wait(30);
			Stage1Unit17;
			wait(480);
			FadeOutMusic(BGM[1],10);
			wait(240);
	}
	if(StagePhaseProgress<=3)
	{
//////////////////////////////////////////////////////////////////
			DeleteMusic(BGM[1]);
			PlayMusic(BGM[2]);
			SetCommonData("STAGE1BOSS",true);
wait(1);		CreateEnemyBossFromFile(csd~"stage1/Stage1Boss.txt",GetClipMaxX-60,GetClipMinY-16,2,0,0);
			WaitForZeroEnemy;
			SetCommonData("STAGE1BOSS",false);
			CreateEnemyFromFile(csd~"stage1/DeleteEnemy.txt",GetClipMinX-64,GetCenterY-48,2,90,1);
	}
}

task Stage1Unit1
{
/*	ascent(let i in 0..5)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX-16-40*i*cos(-15),GetCenterY+30-40*i*sin(-15),1.0,-15,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX-16-40*i*cos(-15),GetCenterY+80-40*i*sin(-15),1.0,-15,1);
	wait(15);
	}
*/
	loop(6)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX-16,GetCenterY-125,1.25,20,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX-16,GetCenterY-75,1.25,20,1);
	wait(45);
	}
}

task Stage1Unit2
{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMaxX-120,GetClipMinY-16,2,90,1);
	wait(20);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMaxX-90,GetClipMinY-16,2,90,1);
	wait(20);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMaxX-60,GetClipMinY-16,2,90,1);
}


task Stage1Unit3
{
/*	ascent(let i in 0..8)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMaxX+16-40*i*cos(165),GetCenterY-170-40*i*sin(165),1.0,165,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMaxX+16-40*i*cos(165),GetCenterY-120-40*i*sin(165),1.0,165,1);
	wait(15);
	}
*/	loop(8)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMaxX+16,GetCenterY-200,1.0,165,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMaxX+16,GetCenterY-150,1.0,165,1);
	wait(45);
	}
}

task Stage1Unit4
{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMinX+120,GetClipMinY-16,2,90,1);
	wait(20);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMinX+90,GetClipMinY-16,2,90,1);
	wait(20);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMinX+60,GetClipMinY-16,2,90,1);
}


task Stage1Unit5
{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX-180,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX-150,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX-120,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX-100,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX-60,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX-40,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+20,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX+60,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+80,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX+120,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+150,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX+180,GetClipMinY-32,1,90,1);
}

task Stage1Unit6
{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX+180,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+150,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX+120,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+100,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX+60,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+40,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX-20,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX-60,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX-80,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX-120,GetClipMinY-32,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX-150,GetClipMinY-64,1,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy05.txt",GetCenterX-180,GetClipMinY-32,1,90,1);
}

task Stage1Unit7
{
	loop(5)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetCenterX-160,GetClipMinY-16,1.0,90,1);
	wait(15);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetCenterX-50,GetClipMinY-16,1.0,90,1);
	wait(15);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetCenterX+160,GetClipMinY-16,1,90,1);
	wait(15);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetCenterX+50,GetClipMinY-16,1,90,1);
	wait(15);
	}
}

task Stage1Unit8
{
/*	ascent(let i in 0..3)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+100-30*i*cos(120),GetClipMinY-16-30*i*sin(120),1.5,120,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+150-30*i*cos(120),GetClipMinY-16-30*i*sin(120),1.5,120,1);
	wait(15);
	}
*/
	loop(3)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+100,GetClipMinY-16,1.5,120,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+150,GetClipMinY-16,1.5,120,1);
	wait(35);
	}
}


task Stage1Unit9
{
/*	ascent(let i in 0..5)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMaxX+16-25*i*cos(210),GetCenterY-25*i*sin(210),1.0,210,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMaxX+16-25*i*cos(210),GetCenterY+50-25*i*sin(210),1.0,210,1);
	wait(30);
	}
*/
	loop(5)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMaxX+16,GetCenterY-100,1.5,170,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMaxX+16,GetCenterY-50,1.5,170,1);
	wait(45);
	}
}

task Stage1Unit10
{
loop(6)
{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMinX+50,GetClipMinY-16,1.0,210,1);
wait(10);
}
}

task Stage1Unit11
{
/*	ascent(let i in 0..6)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+125-50*i*cos(90),GetClipMinY-16-50*i*sin(90),1.0,90,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+50-50*i*cos(90),GetClipMinY-16-50*i*sin(90),1.0,90,1);
	wait(15);
	}
*/
	loop(6)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+125,GetClipMinY-16,1.0,90,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+50,GetClipMinY-16,1.0,90,1);
	wait(45);
	}
}

task Stage1Unit12
{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX+30,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX+90,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX+150,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX+60,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX+120,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX+30,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX+90,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX+150,GetClipMinY-16,2,90,1);
}

task Stage1Unit13
{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX-30,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX-90,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX-150,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX-60,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX-120,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX-30,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX-90,GetClipMinY-16,2,90,1);
	wait(10);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetCenterX-150,GetClipMinY-16,2,90,1);
}

task Stage1Unit14
{
	ascent(let i in 0..5)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMaxX+16-40*i*cos(210),GetClipMaxY-100-40*i*sin(210),1.0,210,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMaxX+16-40*i*cos(210),GetClipMaxY-150-40*i*sin(210),1.0,210,1);
	wait(15);
	}
}

task Stage1Unit15
{
	ascent(let i in 0..12)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+60-30*i*cos(145),GetClipMinY-16-30*i*sin(145),1.2,145,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+140-30*i*cos(145),GetClipMinY-16-30*i*sin(145),1.2,145,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+210-30*i*cos(145),GetClipMinY-16-30*i*sin(145),1.2,145,1);
	wait(15);
	}
}

task Stage1Unit16
{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMinX+150,GetClipMinY-16,2,90,1);
	wait(15);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMinX+100,GetClipMinY-16,2,90,1);
	wait(15);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMinX+50,GetClipMinY-16,2,90,1);
	wait(15);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMinX+125,GetClipMinY-16,2,90,1);
	wait(15);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy04.txt",GetClipMinX+75,GetClipMinY-16,2,90,1);
}

task Stage1Unit17
{
	loop(12)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX-60,GetClipMinY-16,1.2,90,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX-140,GetClipMinY-16,1.2,90,1);
	wait(20);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+60,GetClipMinY-16,1.2,90,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetCenterX+140,GetClipMinY-16,1.2,90,1);
	wait(20);
	}
}