sub Stage1
{
//wait(600000);
	CreateEnemyFromFile(csd~"stage1/LoadEnemy.txt",0,0,0,0,0);
if(PreLoad==2 && StagePractice==false)
{
CompileEnemyFromFile(csd~"stage1/Stage1Enemy01.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy02.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy02a.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy03.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy04.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy05.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy06a.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy06b.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy06c.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy07.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy08.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy09.txt");

CompileEnemyFromFile(csd~"stage1/Daiyousei.txt");
CompileEnemyFromFile(csd~"stage1/Daiyousei1.txt");
CompileEnemyFromFile(csd~"stage1/Daiyousei2.txt");
CompileEnemyFromFile(csd~"stage1/BossDefeat.txt");
CompileEnemyFromFile(csd~"stage1/BossEscape.txt");

CompileEnemyFromFile(csd~"stage2/Stage2Enemy01.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy01a.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy01b.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy02.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy03.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy04.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy05.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy06.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy06a.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy07.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy08.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy09.txt");
CompileEnemyFromFile(csd~"stage2/Stage2Enemy10.txt");

CompileEnemyFromFile(csd~"stage2/LunaChild.txt");
CompileEnemyFromFile(csd~"stage2/BossEscape.txt");
CompileEnemyFromFile(csd~"stage2/Mokou1.txt");
CompileEnemyFromFile(csd~"stage2/Mokou2.txt");
CompileEnemyFromFile(csd~"stage2/BossDefeat.txt");

CompileEnemyFromFile(csd~"stage3/Stage3Elemental.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy01.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy02.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy02a.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy03.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy03a.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy03b.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy03c.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy04.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy05.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy05a.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy06.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy07.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy08.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy09.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy09a.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy09b.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy09c.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy09d.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy09e.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy10.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy11.txt");
CompileEnemyFromFile(csd~"stage3/Stage3Enemy11a.txt");

CompileEnemyFromFile(csd~"stage3/StarSapphire.txt");
CompileEnemyFromFile(csd~"stage3/BossEscape.txt");
CompileEnemyFromFile(csd~"stage3/Nue1.txt");
CompileEnemyFromFile(csd~"stage3/Nue2.txt");
CompileEnemyFromFile(csd~"stage3/Nue3.txt");
CompileEnemyFromFile(csd~"stage3/BossDefeat.txt");

CompileEnemyFromFile(csd~"stage4/Stage4Enemy01.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy01a.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy02.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy02a.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy03.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy03a.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy04.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy04a.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy05.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy06.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy06a.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy07.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy07a.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy08.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy09.txt");
CompileEnemyFromFile(csd~"stage4/Stage4Enemy10.txt");

CompileEnemyFromFile(csd~"stage4/SunnyMilk.txt");
CompileEnemyFromFile(csd~"stage4/BossEscape.txt");
CompileEnemyFromFile(csd~"stage4/Aya1.txt");
CompileEnemyFromFile(csd~"stage4/Aya2.txt");
CompileEnemyFromFile(csd~"stage4/Aya3.txt");
CompileEnemyFromFile(csd~"stage4/BossDefeat.txt");

CompileEnemyFromFile(csd~"stage5/Stage5BigEnemy1.txt");
CompileEnemyFromFile(csd~"stage5/Stage5BigEnemy2.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Elemental.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy01.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy02.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy02a.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy02b.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy03.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy04.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy05.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy06.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy06a.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy07.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy08.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy09.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy09a.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy09b.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy10.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy11.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy12.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy13.txt");
CompileEnemyFromFile(csd~"stage5/Stage5Enemy14.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemyA.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemyRing1.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemyRing2.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemyRing3.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemyRing4.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemyRing5.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemyRing6.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemySnake1.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemySnake2.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemySnake3.txt");
CompileEnemyFromFile(csd~"stage5/Stage5EnemySnake4.txt");

CompileEnemyFromFile(csd~"stage5/Yuuka.txt");
CompileEnemyFromFile(csd~"stage5/BossEscape.txt");
CompileEnemyFromFile(csd~"stage5/Alice1.txt");
CompileEnemyFromFile(csd~"stage5/Alice2.txt");
CompileEnemyFromFile(csd~"stage5/Alice3.txt");
CompileEnemyFromFile(csd~"stage5/Alice4.txt");
CompileEnemyFromFile(csd~"stage5/BossDefeat.txt");
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="Apocalypse")
{
CompileEnemyFromFile(csd~"stage5/Alice5.txt");
CompileEnemyFromFile(csd~"stage5/Alice6.txt");
CompileEnemyFromFile(csd~"stage5/Alice7.txt");
}
}
else if(StagePractice==false && PreLoad==1)
{
CompileEnemyFromFile(csd~"stage1/Stage1Enemy01.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy02.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy02a.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy03.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy04.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy05.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy06a.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy06b.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy06c.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy07.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy08.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy09.txt");

CompileEnemyFromFile(csd~"stage1/Daiyousei.txt");
CompileEnemyFromFile(csd~"stage1/Daiyousei1.txt");
CompileEnemyFromFile(csd~"stage1/Daiyousei2.txt");
CompileEnemyFromFile(csd~"stage1/BossDefeat.txt");
CompileEnemyFromFile(csd~"stage1/BossEscape.txt");
}

else
{
if(StagePhaseProgress<=2 && PreLoad==1)
{
CompileEnemyFromFile(csd~"stage1/Stage1Enemy01.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy02.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy02a.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy03.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy04.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy05.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy06a.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy06b.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy06c.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy07.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy08.txt");
CompileEnemyFromFile(csd~"stage1/Stage1Enemy09.txt");
}
if(StagePhaseProgress<=1 && PreLoad==1)
{
CompileEnemyFromFile(csd~"stage1/Daiyousei.txt");
CompileEnemyFromFile(csd~"stage1/BossEscape.txt");
}
CompileEnemyFromFile(csd~"stage1/Daiyousei1.txt");
CompileEnemyFromFile(csd~"stage1/Daiyousei2.txt");
CompileEnemyFromFile(csd~"stage1/BossDefeat.txt");
}
	if(StagePhaseProgress!=3 || StagePractice==false)
	{
	PlayMusic(BGM[1]); 
	}

	StageWaterEffect;
	wait(120);
	if(StagePhaseProgress==0 || StagePractice==false)
	{
			wait(60);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy01.txt",GetClipMaxX+16,GetCenterY-128,2,90,1);
	Explain(0,0,180);
			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);
	Explain(1,1,180);
			Stage1Unit2;
			wait(60);
			Stage1Unit3;
			wait(60);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy03.txt",GetClipMinX-64,GetCenterY-96,2,90,1);
			wait(180);
		//	Stage1UnitA;
			wait(60);
			Stage1Unit4;
			wait(60);
			wait(60);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy03.txt",GetClipMaxX+64,GetCenterY-96,2,90,-1);
	Explain(2,2,180);
			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);
	Explain(3,4,180);
			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);

			Stage1Hayamawasi_A;
			wait(180);
	Explain(5,6,180);
			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);
	Explain(7,8,180);
			Stage1Unit6;
			wait(100);
			CreateEnemyFromFile(csd~"stage1/Stage1Enemy06b.txt",GetClipMaxX-60,GetClipMinY-76,1,90,1);
			wait(240);
	Explain(9,11,180);
			Stage1Unit5;
			wait(60);
			Stage1Unit7;
			wait(240);
	Explain(12,13,180);
			wait(240);
	}
///////////////////////////////////////////////////////////////////
	if(StagePhaseProgress<=1 || StagePractice==false)
	{
		SetCommonData("STAGE1MIDBOSS",true);

			Stage1MidBossAppear;

			if(GetCommonDataDefault("StrongPlayer",false)==true && GetCommonDataDefault("StrongEffectDone",false)==false)
			{
				SetCommonData("StrongEffect",true);
				SetCommonData("StrongEffectDone",true);
				StageIntervalEffect;
			}

			SetCommonData("STAGE1MIDBOSS",false);
	}
	if(StagePhaseProgress<=2 || StagePractice==false)
	{
			BGStage1MidBossEnd;
	//		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;
	Explain(14,15,180);
			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);
	Explain(16,17,180);
			wait(90);

			SetCommonData("STAGE1HAYAMAWASI",true);
			SetCommonData("STAGE1HAYAMAWASInum",2);
			Stage1Hayamawasi;

			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);
	Explain(18,20,180);
			Stage1Unit17;
			wait(240);
	Explain(21,23,180);
			wait(240);
			FadeOutMusic(BGM[1],10);
			wait(240);
	Explain(24,25,180);
	}
	if(StagePhaseProgress<=3 || StagePractice==false)
	{
//////////////////////////////////////////////////////////////////
			DeleteMusic(BGM[1]);
			PlayMusic(BGM[2]);
			SetCommonData("STAGE1BOSS",true);
			wait(1);
			
			Stage1BossAppear;

			SetCommonData("STAGE1BOSS",false);
			CreateEnemyFromFile(csd~"stage1/DeleteEnemy.txt",GetClipMinX-64,GetCenterY-48,2,90,1);
	}
}

function Stage1MidBossAppear
{
	if(GetCommonDataDefault("ExclusiveBoss",false)==true)
	{
		SetCommonData("IsMSDBossExisting",true);

		CreateEnemyFromFile(csd~"stage1/Daiyousei.txt",GetClipMaxX-60,GetClipMinY-16,2,0,0);
		WaitForZeroEnemy;
		CreateEnemyFromFile(csd~"stage1/BossEscape.txt",GetClipMaxX-60,GetClipMinY-16,2,0,0);
		WaitForZeroEnemy;

		SetCommonData("IsMSDBossExisting",false);
	}
	else
	{
		CreateEnemyBossFromFile(csd~"stage1/Stage1MidBoss.txt",GetClipMaxX-60,GetClipMinY-16,2,0,0);
		WaitForZeroEnemy;
	}
}

function Stage1BossAppear
{
	if(GetCommonDataDefault("ExclusiveBoss",false)==true)
	{
		SetCommonData("IsMSDBossExisting",true);

		CreateEnemyFromFile(csd~"stage1/Daiyousei1.txt",GetClipMaxX-60,GetClipMinY-16,2,0,0);
		WaitForZeroEnemy;
		CreateEnemyFromFile(csd~"stage1/Daiyousei2.txt",GetClipMaxX-60,GetClipMinY-16,2,0,0);
		WaitForZeroEnemy;
		CreateEnemyFromFile(csd~"stage1/BossDefeat.txt",GetClipMaxX-60,GetClipMinY-16,2,0,0);
		CompileEnemyFromFile(csd~"stage2/LoadEnemy.txt");
		WaitForZeroEnemy;

		LoadingStage2Data;
		SetCommonData("IsMSDBossExisting",false);
	}
	else
	{
		CreateEnemyBossFromFile(csd~"stage1/Stage1Boss.txt",GetClipMaxX-60,GetClipMinY-16,2,0,0);
		WaitForZeroEnemy;
	}

	task LoadingStage2Data
	{
	let wt=3;
	if(StagePractice==false && PreLoad==1)
	{
	CreateEnemyFromFile(csd~"stage2/LoadEnemy.txt",0,0,0,0,0);
	ClearByteCodeCache;
	wait(60);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy01.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy01a.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy01b.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy02.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy03.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy04.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy05.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy06.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy06a.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy07.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy08.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy09.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Stage2Enemy10.txt");wait(wt);

	CompileEnemyFromFile(csd~"stage2/LunaChild.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Mokou1.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/Mokou2.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/BossDefeat.txt");wait(wt);
	CompileEnemyFromFile(csd~"stage2/BossEscape.txt");wait(wt);
	}
	}
}

task Stage1Hayamawasi_A
{
	let count=0;
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy06a_A.txt",GetClipMinX+60,GetClipMinY-76,1,90,1);
	loop(180)
	{
		if(GetCommonDataDefault("Stage1HayamawasiA",0)==1){break;}
		count+=1;
		yield;
	}
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy09_A.txt",GetClipMinX+30,GetClipMinY-16,1,90,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy09_A.txt",GetClipMinX+100,GetClipMinY-16,1,90,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy09_A.txt",GetClipMinX+170,GetClipMinY-16,1,90,1);
	loop(120)
	{
		if(GetCommonDataDefault("Stage1HayamawasiB",0)==3){break;}
		count+=1;
		yield;
	}
	if(count<=180)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy09.txt",GetClipMaxX-30,GetClipMinY-16,1,90,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy09.txt",GetClipMaxX-100,GetClipMinY-16,1,90,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy09.txt",GetClipMaxX-170,GetClipMinY-16,1,90,1);
	}
}

task Stage1Hayamawasi
{
let count=0;
	loop(360)
	{
		if(GetCommonDataDefault("STAGE1HAYAMAWASInum",2)==0){break;}
		count+=1;
		yield;
	}
	loop(360)
	{
	if(count==180)
	{
		CreateEnemyFromFile(csd~"stage1/Stage1Enemy06c.txt",GetCenterX,GetClipMinY-76,0.75,90,1);
		break;
	}
	count+=1;
	yield;
	}
	SetCommonData("STAGE1HAYAMAWASI",false);
	SetCommonData("STAGE1HAYAMAWASInum",0);
}

task Stage1Unit1
{
	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
{
	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 Stage1UnitA
{
	loop(3)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+0,GetCenterY-255,1.25,20,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+0,GetCenterY-205,1.25,20,1);
	wait(45);
	}
}

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
{

	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
{

	loop(5)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02a.txt",GetClipMaxX+16,GetCenterY-100,1.5,170,1);
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02a.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
{

	loop(6)
	{
	CreateEnemyFromFile(csd~"stage1/Stage1Enemy02.txt",GetClipMinX+120,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);
	}
}