#TouhouDanmakufu[Stage]
#Title[Touhou Genyoubu - City of Distortion (DEMO)]
#Text[Touhou Genyoubu Demo Version 2.0
3 Stages, Easy and Normal, Now with main menu and .dat files

Players: Patchy and Keine

Made by KakeraGames]
#BackGround[User("", 0, 0)]
#Player[.\patchy.txt, .\keine.txt]
#ScriptVersion[2]

script_stage_main
{
	function LoadCommonDataGenyoubu
	{
		let CDLIST = ["MusicUnlock", "StageUnlock", "Config"];
		let i = 0;
		while(i<length(CDLIST))
		{
			if(!IsCommonDataAreaExists(CDLIST[i])){CreateCommonDataArea(CDLIST[i]);}
			i++;
		}
	
		LoadCommonDataEx("MusicUnlock", GetCurrentScriptDirectory~"DATA/MENU/MUSIC.dat");
		LoadCommonDataEx("StageUnlock", GetCurrentScriptDirectory~"DATA/MENU/STAGE.dat");
		LoadCommonDataEx("Config", GetCurrentScriptDirectory~"DATA\CONFIG.dat");
	}

	function ClearCommonDataGenyoubu
	{
		let i = 1;
		while(i<length(cdrot))
		{
			SetCommonDataEx("MusicUnlock", "Music"~cdrot[i], 0);
			i++;
		}
		SetCommonDataEx("StageUnlock", "StagePatchyEasy", 1);
		SetCommonDataEx("StageUnlock", "StageKeineEasy", 1);
		SetCommonDataEx("StageUnlock", "StageChenEasy", 1);
		SetCommonDataEx("StageUnlock", "StagePatchyNormal", 1);
		SetCommonDataEx("StageUnlock", "StageKeineNormal", 1);
		SetCommonDataEx("StageUnlock", "StageChenNormal", 1);
		SetCommonDataEx("StageUnlock", "StagePatchyHard", 1);
		SetCommonDataEx("StageUnlock", "StageKeineHard", 1);
		SetCommonDataEx("StageUnlock", "StageChenHard", 1);
		SetCommonDataEx("StageUnlock", "StagePatchyLunatic", 1);
		SetCommonDataEx("StageUnlock", "StageKeineLunatic", 1);
		SetCommonDataEx("StageUnlock", "StageChenLunatic", 1);
		SetCommonDataEx("StageUnlock", "ExtraPatchy", 0);
		SetCommonDataEx("StageUnlock", "ExtraKeine", 0);
		SetCommonDataEx("StageUnlock", "ExtraChen", 0);

		SetCommonDataEx("Config", "SLives", 3);

		SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");
		SaveCommonDataEx("StageUnlock", gcsd~"DATA/MENU/STAGE.dat");
		SaveCommonDataEx("Config", GetCurrentScriptDirectory~"DATA/CONFIG.dat");
	}

	function Wait(let frames){loop(frames){yield;}}
	function WaitEnemy{while(GetEnemyNum!=0){yield;}}

	let gcsd = GetCurrentScriptDirectory;
	let back = gcsd~"01b.png";
	let bgm = gcsd~"001.mp3";
	let textpic = gcsd~"01stx.png";
	let stagepic = gcsd~"01st.png";
	let extend = gcsd~"se000.wav";

	let backalpha = 0;
	let lives = 0;
	let textalpha = 0;
	let stgalpha = 0;
	let grazemark = 100;

	let xmod = 0;

	let menu = true;
	let listener = false;
	let menux = 0;
	let menua = 0;

	let menuindex = 0;
	let submenu = 0;

	let pracselect = 0;
	let prac = false;

	let menu001 = gcsd~"menu001.png";	//Game Start
	let menu002 = gcsd~"menu002.png";	//Battle Room
	let menu003 = gcsd~"menu003.png";	//Practice Start
	let menu004 = gcsd~"menu004.png";	//Music Room
	let menu005 = gcsd~"menu005.png";	//Exit Game
	let menu006 = gcsd~"menu006.png";	//Configuration
	let menu010 = gcsd~"menu010.png";	//Easy
	let menu011 = gcsd~"menu011.png";	//Normal
	let menu012 = gcsd~"menu012.png";	//Hard
	let menu013 = gcsd~"menu013.png";	//Lunatic
	let menu020 = gcsd~"menu020.png";	//Tier 1
	let menu021 = gcsd~"menu021.png";	//Tier 2
	let menu022 = gcsd~"menu022.png";	//Tier 3
	let menu023 = gcsd~"menu023.png";	//Tier 4
	let menu024 = gcsd~"menu024.png";	//Tier 5
	let menu030 = gcsd~"menu030.png";	//Stage 1
	let menu031 = gcsd~"menu031.png";	//Stage 2
	let menu032 = gcsd~"menu032.png";	//Stage 3
	let menu033 = gcsd~"menu033.png";	//Stage 4
	let menu034 = gcsd~"menu034.png";	//Stage 5
	let menu035 = gcsd~"menu035.png";	//Stage 6
	let menu040 = gcsd~"menu040.png";	//Hidden Music
	let menu041 = gcsd~"menu041.png";	//Arrow Pointer
	let menu400 = gcsd~"menu400.png";
	let menu401 = gcsd~"menu401.png";
	let menu402 = gcsd~"menu402.png";
	let menu403 = gcsd~"menu403.png";
	let menu404 = gcsd~"menu404.png";
	let menu405 = gcsd~"menu405.png";
	let menu406 = gcsd~"menu406.png";
	let menu407 = gcsd~"menu407.png";
	let menu408 = gcsd~"menu408.png";
	let menu409 = gcsd~"menu409.png";
	let menu410 = gcsd~"menu410.png";
	let menu411 = gcsd~"menu411.png";
	let menu412 = gcsd~"menu412.png";
	let menu413 = gcsd~"menu413.png";
	let menu414 = gcsd~"menu414.png";
	let menu415 = gcsd~"menu415.png";
	let menu416 = gcsd~"menu416.png";
	let menu417 = gcsd~"menu417.png";
	let menu418 = gcsd~"menu418.png";
	let menu419 = gcsd~"menu419.png";
	let menu420 = gcsd~"menu420.png";
	let menu421 = gcsd~"menu421.png";
	let menu060 = gcsd~"menu060.png";	//Starting Lives
	let menu061 = gcsd~"menu061.png";	//Delete All Data
	let menu600 = gcsd~"menu600.png";	//You Sure?
	let menu601 = gcsd~"menu601.png";	//Yes
	let menu602 = gcsd~"menu602.png";	//No
	let menu610 = gcsd~"menu610.png";	//1
	let menu611 = gcsd~"menu611.png";	//2
	let menu612 = gcsd~"menu612.png";	//3
	let menu613 = gcsd~"menu613.png";	//4
	let menu614 = gcsd~"menu614.png";	//5

	let menurot = [menu400,menu401,menu402,menu403,menu404,menu405,menu406,menu407,menu408,menu409,menu410,menu411,menu412,menu413,menu414,menu415,menu416,menu417,menu418,menu419,menu420,menu421];
	let cdrot = ["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21"];
	let menum1 = 0;let menum2 = 0;let menum3 = 0;let menum4 = 0;let menup1 = 0;let menup2 = 0;let menup3 = 0;let menup4 = 0;

	let lifemenu = 0;
	let pracdiff = "NoneSelected";

	let menumusic = gcsd~"000.mp3";
	let musicroom = gcsd~"000.mp3";

	let select00 = gcsd~"se009.mp3";
	let ok00 = gcsd~"se010.mp3";
	let cancel00 = gcsd~"se011.mp3";
	let invalid00 = gcsd~"se012.mp3";

	@Initialize
	{
		ExpertEx(false, 3, 3);
		LoadCommonDataGenyoubu;
		SetCommonDataEx("MusicUnlock", "Music00", 1);
		SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");

		lifemenu = GetCommonDataDefaultEx("Config", "SLives", 3);

		ForbidBomb(true);
		ForbidShot(true);

		LoadGraphic(back);
		LoadGraphic(textpic);
		LoadGraphic(stagepic);
		LoadMusic(bgm);
		LoadMusic(menumusic);
		LoadSE(extend);
		LoadSE(select00);
		LoadSE(ok00);
		LoadSE(cancel00);
		LoadSE(invalid00);

		LoadGraphic(menu001);LoadGraphic(menu002);LoadGraphic(menu003);LoadGraphic(menu004);LoadGraphic(menu005);LoadGraphic(menu006);LoadGraphic(menu010);LoadGraphic(menu011);LoadGraphic(menu012);LoadGraphic(menu013);LoadGraphic(menu030);LoadGraphic(menu031);LoadGraphic(menu032);LoadGraphic(menu033);LoadGraphic(menu034);LoadGraphic(menu035);LoadGraphic(menu040);LoadGraphic(menu041);
		LoadGraphic(menu400);LoadGraphic(menu401);LoadGraphic(menu402);LoadGraphic(menu403);LoadGraphic(menu404);LoadGraphic(menu405);LoadGraphic(menu406);LoadGraphic(menu407);LoadGraphic(menu408);LoadGraphic(menu409);LoadGraphic(menu410);LoadGraphic(menu411);LoadGraphic(menu412);LoadGraphic(menu413);LoadGraphic(menu414);LoadGraphic(menu415);LoadGraphic(menu416);LoadGraphic(menu417);LoadGraphic(menu418);LoadGraphic(menu419);LoadGraphic(menu420);LoadGraphic(menu421);
		LoadGraphic(menu060);LoadGraphic(menu061);LoadGraphic(menu600);LoadGraphic(menu601);LoadGraphic(menu602);LoadGraphic(menu610);LoadGraphic(menu611);LoadGraphic(menu612);LoadGraphic(menu613);LoadGraphic(menu614);

		PlayMusic(menumusic);
		menustart;
	}

	sub menustart
	{
		loop(240){yield;}
		menufadein;
	}

	@MainLoop
	{
		if(GetScore>=20000000&&lives==0){ExtendPlayer(1); lives++;PlaySE(extend);}
		if(GetScore>=40000000&&lives==1){ExtendPlayer(1); lives++;PlaySE(extend);}
		if(GetScore>=80000000&&lives==2){ExtendPlayer(1); lives++;PlaySE(extend);}
		if(GetScore>=160000000&&lives==3){ExtendPlayer(1); lives++;PlaySE(extend);}
		if(GetScore>=250000000&&lives==4){ExtendPlayer(1); lives++;PlaySE(extend);}
		if(GetScore>=500000000&&lives==5){ExtendPlayer(1); lives++;PlaySE(extend);}
		if(GetScore>=1000000000&&lives==6){ExtendPlayer(1); lives++;PlaySE(extend);}
		if(GetScore>=2000000000&&lives==7){ExtendPlayer(1); lives++;PlaySE(extend);}

		if(menu)
		{
			SetPlayerX(GetCenterX);SetPlayerY(GetClipMaxY-90);

			if(listener)
			{
				if(GetKeyState(VK_DOWN)==KEY_PUSH){menuindex++;}
				if(GetKeyState(VK_UP)==KEY_PUSH){menuindex--;}
				if(GetKeyState(VK_LEFT)==KEY_PUSH)
				{
					lifemenu--; if(lifemenu<1){lifemenu=5;}
					SetCommonDataEx("Config", "SLives", lifemenu);
					SaveCommonDataEx("Config", gcsd~"DATA\CONFIG.dat");
				}
				if(GetKeyState(VK_RIGHT)==KEY_PUSH)
				{
					lifemenu++; if(lifemenu>5){lifemenu=1;}
					SetCommonDataEx("Config", "SLives", lifemenu);
					SaveCommonDataEx("Config", gcsd~"DATA\CONFIG.dat");
				}
				if(GetKeyState(VK_SHOT)==KEY_PUSH)
				{
					if(submenu==0&&menuindex==0){PlaySE(ok00); menufadeout(1, 0);}
					else if(submenu==0&&menuindex==2){PlaySE(ok00); menufadeout(4, 0);}
					else if(submenu==0&&menuindex==3){PlaySE(ok00); menufadeout(5, 0);}
					else if(submenu==0&&menuindex==4){PlaySE(ok00); menufadeout(6, 0);}
					else if(submenu==0&&menuindex==5){PlaySE(ok00); menufadeout(-1, 0);}
					else if(submenu==1&&menuindex==0){PlaySE(ok00); menufadeout(-1, 0);}
					else if(submenu==1&&menuindex==1){PlaySE(ok00); menufadeout(-1, 0);}
					else if(submenu==3&&menuindex==0){PlaySE(ok00); menufadeout(-1, 0);}
					else if(submenu==3&&menuindex==1)
					{
						if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchy"~pracdiff, 1)>=2){PlaySE(ok00); menufadeout(-1, 0);}
						else if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeine"~pracdiff, 1)>=2){PlaySE(ok00); menufadeout(-1, 0);}
						else if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChen"~pracdiff, 1)>=2){PlaySE(ok00); menufadeout(-1, 0);}
						else{PlaySE(invalid00);}
					}
					else if(submenu==3&&menuindex==2)
					{
						if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchy"~pracdiff, 1)>=3){PlaySE(ok00); menufadeout(-1, 0);}
						else if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeine"~pracdiff, 1)>=3){PlaySE(ok00); menufadeout(-1, 0);}
						else if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChen"~pracdiff, 1)>=3){PlaySE(ok00); menufadeout(-1, 0);}
						else{PlaySE(invalid00);}
					}
					else if(submenu==4&&menuindex==0){pracdiff="Easy"; PlaySE(ok00); menufadeout(3,0);}
					else if(submenu==4&&menuindex==1){pracdiff="Normal"; PlaySE(ok00); menufadeout(3,0);}

					else if(submenu==5)
					{
						let CDNAME = cdrot[menuindex];
						if(GetCommonDataDefaultEx("MusicUnlock", "Music"~CDNAME, 0)!=0)
						{
							if(musicroom!=gcsd~"0"~CDNAME~".mp3")
							{
								DeleteMusic(musicroom);
								musicroom=gcsd~"0"~CDNAME~".mp3";
								LoadMusic(musicroom);
								PlayMusic(musicroom);
							}
						}
						else{PlaySE(invalid00);}
					}

					else if(submenu==6&&menuindex==0){}
					else if(submenu==6&&menuindex==1){PlaySE(ok00); menufadeout(7,0);}
					else if(submenu==7&&menuindex==0){PlaySE(ok00); ClearCommonDataGenyoubu; menufadeout(0,0);}
					else if(submenu==7&&menuindex==1){PlaySE(ok00); menufadeout(6,0);}

					else{PlaySE(invalid00);}
				}
				if(GetKeyState(VK_BOMB)==KEY_PUSH)
				{
					PlaySE(cancel00);
					if(submenu==0){menuindex=4;}
					if(submenu==1){menufadeout(0, 0);}
					if(submenu==3){menufadeout(4, 0);}
					if(submenu==4){menufadeout(0, 2);}
					if(submenu==5){menufadeout(0, 3); PlayMusic(menumusic);}
					if(submenu==6){menufadeout(0, 4);}
					if(submenu==7){menufadeout(6, 1);}
				}
			}

			if(submenu==0)
			{
				if(menuindex>5){menuindex=0;}
				if(menuindex<0){menuindex=5;}
			}
			if(submenu==1)
			{
				if(menuindex>3){menuindex=0;}
				if(menuindex<0){menuindex=3;}
			}
			if(submenu==2)
			{
				if(menuindex>4){menuindex=0;}
				if(menuindex<0){menuindex=4;}
			}
			if(submenu==3)
			{
				if(menuindex>5){menuindex=0;}
				if(menuindex<0){menuindex=5;}
			}
			if(submenu==4)
			{
				if(menuindex>3){menuindex=0;}
				if(menuindex<0){menuindex=3;}
			}
			if(submenu==5)
			{
				menum1 = menuindex - 1;
				menum2 = menuindex - 2;
				menum3 = menuindex - 3;
				menum4 = menuindex - 4;
				menup1 = menuindex + 1;
				menup2 = menuindex + 2;
				menup3 = menuindex + 3;
				menup4 = menuindex + 4;
				if(menuindex>21){menuindex-=22;}
				if(menuindex<0){menuindex+=22;}
				if(menum1>21){menum1-=22;}
				if(menum1<0){menum1+=22;}
				if(menum2>21){menum2-=22;}
				if(menum2<0){menum2+=22;}
				if(menum3>21){menum3-=22;}
				if(menum3<0){menum3+=22;}
				if(menum4>21){menum4-=22;}
				if(menum4<0){menum4+=22;}
				if(menup1>21){menup1-=22;}
				if(menup1<0){menup1+=22;}
				if(menup2>21){menup2-=22;}
				if(menup2<0){menup2+=22;}
				if(menup3>21){menup3-=22;}
				if(menup3<0){menup3+=22;}
				if(menup4>21){menup4-=22;}
				if(menup4<0){menup4+=22;}
			}

			if(submenu==6)
			{
				if(menuindex>1){menuindex=0;}
				if(menuindex<0){menuindex=1;}
			}

			if(submenu==7)
			{
				if(menuindex>1){menuindex=0;}
				if(menuindex<0){menuindex=1;}
			}

			ForbidBomb(true);
			ForbidShot(true);
		}

		yield;
	}

	@DrawLoop
	{
	}

	@BackGround
	{
		SetTexture(back);
		SetGraphicRect(0, 0, 640, 640);
		SetGraphicScale(1.1, 1.1);
		SetAlpha(backalpha);
		DrawGraphic(GetCenterX, GetClipMinY+120);

		SetTexture(stagepic);
		SetGraphicRect(0, 0, 400, 100);
		SetGraphicScale(0.5, 0.5);
		SetAlpha(stgalpha);
		DrawGraphic(GetCenterX, GetCenterY-120);

		SetTexture(textpic);
		SetGraphicRect(0, 0, 691, 150);
		SetGraphicScale(0.5, 0.5);
		SetAlpha(textalpha);
		DrawGraphic(GetCenterX, GetCenterY-40);

		let string = "" ~ ToString(GetGraze);
     		let number = 0;
     		let graze = "";
      		while(number < length(string) && string[number] != '.')
		{
             			graze = graze ~ ToString(string[number]);
             			number++;
      		}

		let string = "" ~ ToString(grazemark);
     		let number = 0;
     		let mark = "";
      		while(number < length(string) && string[number] != '.')
		{
             			mark = mark ~ ToString(string[number]);
             			number++;
      		}
		let str = "Graze: " ~ graze ~ "/" ~ mark;

		if(GetGraze<grazemark){SetFontColor(0, 0, 255, 0, 0, 255);}
		else{SetFontColor(0, 200, 0, 0, 200, 0);}
		DrawText(str, GetClipMinX+8, GetClipMaxY-32, 12, 255);
		SetFontColor(0, 0, 255, 0, 0, 255);


		//--------------------MENU ITEMS--------------------
		let ablealpha = 0;
		let abletext = menu040;
		if(submenu==0&&menu==true)
		{
			ablealpha = 255;
			SetTexture(menu001);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==0){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-90);

			ablealpha = 100;
			if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "ExtraPatchy", 0)>=1){ablealpha=255;}
			if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "ExtraKeine", 0)>=1){ablealpha=255;}
			if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "ExtraChen", 0)>=1){ablealpha=255;}
			SetTexture(menu002);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==1){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-60);

			ablealpha = 255;
			SetTexture(menu003);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==2){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-30);

			SetTexture(menu004);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==3){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY);

			SetTexture(menu006);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==4){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY+30);

			SetTexture(menu005);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==5){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY+60);
		}

		if((submenu==1||submenu==4)&&menu==true)
		{
			ablealpha = 255;
			SetTexture(menu010);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==0){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-45);

			ablealpha = 255;
			SetTexture(menu011);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==1){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-15);

			ablealpha = 100;
			SetTexture(menu012);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==2){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY+15);

			ablealpha = 100;
			SetTexture(menu013);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==3){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY+45);
		}

		if(submenu==3&&menu==true)
		{
			ablealpha = 255;
			SetTexture(menu030);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==0){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-105);

			ablealpha = 100;
			if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchy"~pracdiff, 1)>=2){ablealpha=255;}
			if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeine"~pracdiff, 1)>=2){ablealpha=255;}
			if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChen"~pracdiff, 1)>=2){ablealpha=255;}
			SetTexture(menu031);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==1){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-75);

			ablealpha = 100;
			if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchy"~pracdiff, 1)>=3){ablealpha=255;}
			if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeine"~pracdiff, 1)>=3){ablealpha=255;}
			if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChen"~pracdiff, 1)>=3){ablealpha=255;}
			SetTexture(menu032);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==2){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-45);

			ablealpha = 100;
			if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchy"~pracdiff, 1)>=4){ablealpha=255;}
			if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeine"~pracdiff, 1)>=4){ablealpha=255;}
			if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChen"~pracdiff, 1)>=4){ablealpha=255;}
			SetTexture(menu033);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==3){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-15);

			ablealpha = 100;
			if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchy"~pracdiff, 1)>=5){ablealpha=255;}
			if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeine"~pracdiff, 1)>=5){ablealpha=255;}
			if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChen"~pracdiff, 1)>=5){ablealpha=255;}
			SetTexture(menu034);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==4){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY+15);

			ablealpha = 100;
			if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchy"~pracdiff, 1)>=6){ablealpha=255;}
			if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeine"~pracdiff, 1)>=6){ablealpha=255;}
			if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChen"~pracdiff, 1)>=6){ablealpha=255;}
			SetTexture(menu035);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==5){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY+45);
		}

		let CDNAME = "NoMusic";
		if(submenu==5&&menu==true)
		{
			CDNAME = "Music"~cdrot[menuindex];
			if(GetCommonDataDefaultEx("MusicUnlock", CDNAME, 0)==0){abletext = menu040;} else{abletext = menurot[menuindex];}
			SetTexture(abletext);
			SetGraphicRect(0, 0, 500, 36); //x=350
			SetGraphicScale(0.7, 0.5);
			SetAlpha(255*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+70, GetClipMinY+110);

			SetTexture(menu041);
			SetGraphicRect(0, 0, 50, 36);	//x=35
			SetGraphicScale(0.5, 0.5);
			SetAlpha(255*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+70-180, GetClipMinY+110);

			CDNAME = "Music"~cdrot[menum1];
			if(GetCommonDataDefaultEx("MusicUnlock", CDNAME, 0)==0){abletext = menu040;} else{abletext = menurot[menum1];}
			SetTexture(abletext);
			SetGraphicRect(0, 0, 500, 36);
			SetGraphicScale(0.7, 0.45);
			SetAlpha(150*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+70, GetClipMinY+90);

			CDNAME = "Music"~cdrot[menum2];
			if(GetCommonDataDefaultEx("MusicUnlock", CDNAME, 0)==0){abletext = menu040;} else{abletext = menurot[menum2];}
			SetTexture(abletext);
			SetGraphicRect(0, 0, 500, 36);
			SetGraphicScale(0.7, 0.4);
			SetAlpha(100*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+70, GetClipMinY+72);

			CDNAME = "Music"~cdrot[menum3];
			if(GetCommonDataDefaultEx("MusicUnlock", CDNAME, 0)==0){abletext = menu040;} else{abletext = menurot[menum3];}
			SetTexture(abletext);
			SetGraphicRect(0, 0, 500, 36);
			SetGraphicScale(0.7, 0.25);
			SetAlpha(50*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+70, GetClipMinY+56);

			CDNAME = "Music"~cdrot[menum4];
			if(GetCommonDataDefaultEx("MusicUnlock", CDNAME, 0)==0){abletext = menu040;} else{abletext = menurot[menum4];}
			SetTexture(abletext);
			SetGraphicRect(0, 0, 500, 36);
			SetGraphicScale(0.7, 0.05);
			SetAlpha(25*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+70, GetClipMinY+42);

			CDNAME = "Music"~cdrot[menup1];
			if(GetCommonDataDefaultEx("MusicUnlock", CDNAME, 0)==0){abletext = menu040;} else{abletext = menurot[menup1];}
			SetTexture(abletext);
			SetGraphicRect(0, 0, 500, 36);
			SetGraphicScale(0.7, 0.45);
			SetAlpha(150*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+70, GetClipMinY+130);

			CDNAME = "Music"~cdrot[menup2];
			if(GetCommonDataDefaultEx("MusicUnlock", CDNAME, 0)==0){abletext = menu040;} else{abletext = menurot[menup2];}
			SetTexture(abletext);
			SetGraphicRect(0, 0, 500, 36);
			SetGraphicScale(0.7, 0.4);
			SetAlpha(100*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+70, GetClipMinY+148);

			CDNAME = "Music"~cdrot[menup3];
			if(GetCommonDataDefaultEx("MusicUnlock", CDNAME, 0)==0){abletext = menu040;} else{abletext = menurot[menup3];}
			SetTexture(abletext);
			SetGraphicRect(0, 0, 500, 36);
			SetGraphicScale(0.7, 0.25);
			SetAlpha(50*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+70, GetClipMinY+164);

			CDNAME = "Music"~cdrot[menup4];
			if(GetCommonDataDefaultEx("MusicUnlock", CDNAME, 0)==0){abletext = menu040;} else{abletext = menurot[menup4];}
			SetTexture(abletext);
			SetGraphicRect(0, 0, 500, 36);
			SetGraphicScale(0.7, 0.05);
			SetAlpha(25*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+70, GetClipMinY+178);
		}

		if(submenu==6&&menu==true)
		{
			ablealpha=255;
			SetTexture(menu060);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==0){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-15);

			SetTexture(menu061);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==1){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY+15);

			if(lifemenu==1)
			{
				SetTexture(menu610);
				SetGraphicRect(0, 0, 80, 80);
				SetGraphicScale(0.4, 0.4);
				SetAlpha(ablealpha*sin(menua)/1.5);
				if(menuindex==0){SetAlpha(ablealpha*sin(menua));}
				DrawGraphic(GetCenterX+100*sin(menux+150)+180, GetCenterY-15);
			}
			if(lifemenu==2)
			{
				SetTexture(menu611);
				SetGraphicRect(0, 0, 80, 80);
				SetGraphicScale(0.4, 0.4);
				SetAlpha(ablealpha*sin(menua)/1.5);
				if(menuindex==0){SetAlpha(ablealpha*sin(menua));}
				DrawGraphic(GetCenterX+100*sin(menux+150)+180, GetCenterY-15);
			}
			if(lifemenu==3)
			{
				SetTexture(menu612);
				SetGraphicRect(0, 0, 80, 80);
				SetGraphicScale(0.4, 0.4);
				SetAlpha(ablealpha*sin(menua)/1.5);
				if(menuindex==0){SetAlpha(ablealpha*sin(menua));}
				DrawGraphic(GetCenterX+100*sin(menux+150)+180, GetCenterY-15);
			}
			if(lifemenu==4)
			{
				SetTexture(menu613);
				SetGraphicRect(0, 0, 80, 80);
				SetGraphicScale(0.4, 0.4);
				SetAlpha(ablealpha*sin(menua)/1.5);
				if(menuindex==0){SetAlpha(ablealpha*sin(menua));}
				DrawGraphic(GetCenterX+100*sin(menux+150)+180, GetCenterY-15);
			}
			if(lifemenu==5)
			{
				SetTexture(menu614);
				SetGraphicRect(0, 0, 80, 80);
				SetGraphicScale(0.4, 0.4);
				SetAlpha(ablealpha*sin(menua)/1.5);
				if(menuindex==0){SetAlpha(ablealpha*sin(menua));}
				DrawGraphic(GetCenterX+100*sin(menux+150)+180, GetCenterY-15);
			}
		}

		if(submenu==7&&menu==true)
		{
			ablealpha=255;
			SetTexture(menu600);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua));
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY-45);

			SetTexture(menu601);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==0){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY);

			SetTexture(menu602);
			SetGraphicRect(0, 0, 500, 80);
			SetGraphicScale(0.4, 0.4);
			SetAlpha(ablealpha*sin(menua)/1.5);
			if(menuindex==1){SetAlpha(ablealpha*sin(menua));}
			DrawGraphic(GetCenterX+100*sin(menux+150)+60, GetCenterY+30);
		}
	}

	task menufadeout(let newmenu, let newindex)
	{
		listener=false;
		loop(60)
		{
			menua-=(90/60);
			menux-=(255/90);
			yield;
		}
		if(newmenu!=-1){menuindex=newindex; submenu=newmenu; menufadein;}
		else
		{
			let lifediff = lifemenu - GetPlayerLife;
			let pracd = 8-GetPlayerLife;

			menu=false;

			if(submenu==0&&menuindex==5){SetClearFrameEffectEnable(false); ClearStage;}
			else{ForbidBomb(false); ForbidShot(false); loop(120){yield;}}

			if(submenu==1&&menuindex==1){prac=false; stage1; ExtendPlayer(lifediff);}
			if(submenu==1&&menuindex==0){prac=false; stage1easy; ExtendPlayer(lifediff);}
			if(submenu==3)
			{
				prac=true;
				ExtendPlayer(pracd);
				if(menuindex==0)
				{
					if(pracdiff=="Easy"){stage1easy;}
					if(pracdiff=="Normal"){stage1;}
				}
				if(menuindex==1)
				{
					if(pracdiff=="Easy"){stage2easy;}
					if(pracdiff=="Normal"){stage2;}
				}
				if(menuindex==2)
				{
					if(pracdiff=="Easy"){stage3easy;}
					if(pracdiff=="Normal"){stage3;}
				}
				
			}
		}
	}

	task menufadein
	{
		loop(60)
		{
			menua+=(90/60);
			menux+=(255/90);
			yield;
		}
		listener=true;
	}

	@Finalize
	{
	}


	task stage1
	{
		PlayMusic(bgm);
		SetCommonDataEx("MusicUnlock", "Music01", 1);
		SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");
		Wait(30);
		CreateEnemyFromFile(gcsd~"bgm.txt", 0, 0, 0, 0, gcsd~"menu401.png");
		Wait(30);
		loop(51){stgalpha+=5; yield;}
		loop(51){textalpha+=5; yield;}
		loop(102){backalpha+=2.5; yield;}
		loop(51){stgalpha-=5; yield;}
		loop(51){textalpha-=5; yield;}
		Wait(60);
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		loop(7)
		{
			CreateEnemyFromFile(gcsd~"01.txt", GetClipMinX+48+xmod, GetClipMinY, 2, 90, 0);
			xmod+=48;
			Wait(60);
		}
		Wait(60);
		xmod-=48;
		loop(7)
		{
			CreateEnemyFromFile(gcsd~"01.txt", GetClipMinX+48+xmod, GetClipMinY, 2, 90, 0);
			xmod-=48;
			Wait(60);
		}
		Wait(60);
		xmod+=48;
		loop(7)
		{
			CreateEnemyFromFile(gcsd~"01.txt", GetClipMinX+48+xmod, GetClipMinY, 2, 90, 0);
			CreateEnemyFromFile(gcsd~"01a.txt", GetClipMaxX-48-xmod, GetClipMinY, 1, 90, 0);
			xmod+=48;
			Wait(60);
		}
		WaitEnemy;
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		loop(16)
		{
			CreateEnemyFromFile(gcsd~"02.txt", GetClipMinX, GetClipMinY+rand(48, 256), rand(1, 3), rand(0, 5), rand(60, 90));
			Wait(10);
		}
		Wait(60);
		loop(16)
		{
			CreateEnemyFromFile(gcsd~"02a.txt", GetClipMaxX, GetClipMinY+rand(48, 256), rand(1, 3), rand(175, 180), rand(60, 90));
			Wait(10);
		}
		WaitEnemy;
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyBossFromFile(gcsd~"m1plun.txt", GetClipMaxX, 0, 0, 0, 0);
		WaitEnemy;
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"02.txt", GetClipMinX, GetClipMinY+rand(48, 128), rand(1, 3), rand(0, 5), rand(60, 90));
			CreateEnemyFromFile(gcsd~"02.txt", GetClipMaxX, GetClipMinY+rand(48, 128), rand(1, 3), rand(175, 180), rand(60, 90));
			Wait(10);
		}
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"02a.txt", GetClipMinX, GetClipMinY+rand(48, 128), rand(1, 3), rand(0, 5), rand(60, 90));
			CreateEnemyFromFile(gcsd~"02a.txt", GetClipMaxX, GetClipMinY+rand(48, 128), rand(1, 3), rand(175, 180), rand(60, 90));
			Wait(10);
		}
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"02.txt", GetClipMinX, GetClipMinY+rand(48, 128), rand(1, 3), rand(0, 5), rand(60, 90));
			CreateEnemyFromFile(gcsd~"02.txt", GetClipMaxX, GetClipMinY+rand(48, 128), rand(1, 3), rand(175, 180), rand(60, 90));
			Wait(10);
		}
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"02a.txt", GetClipMinX, GetClipMinY+rand(48, 128), rand(1, 3), rand(0, 5), rand(60, 90));
			CreateEnemyFromFile(gcsd~"02a.txt", GetClipMaxX, GetClipMinY+rand(48, 128), rand(1, 3), rand(175, 180), rand(60, 90));
			Wait(10);
		}
		Wait(120);
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		xmod = 0;
		loop(7)
		{
			CreateEnemyFromFile(gcsd~"01.txt", GetClipMaxX-48-xmod, GetClipMinY, 2, 90, 0);
			CreateEnemyFromFile(gcsd~"01a.txt", GetClipMinX+48+xmod, GetClipMinY, 1, 90, 0);
			xmod+=48;
			Wait(30);
		}
		xmod = 0;
		loop(7)
		{
			CreateEnemyFromFile(gcsd~"01.txt", GetClipMinX+48+xmod, GetClipMinY, 2, 90, 0);
			CreateEnemyFromFile(gcsd~"01a.txt", GetClipMaxX-48-xmod, GetClipMinY, 1, 90, 0);
			xmod+=48;
			Wait(30);
		}
		WaitEnemy;
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyBossFromFile(gcsd~"b1plun.txt", GetCenterX, 0, 0, 0, 0);
		WaitEnemy;
		if(GetGraze>=grazemark&&prac==false){Wait(120); CreateEnemyBossFromFile(gcsd~"b1lwn.txt", GetCenterX, 0, 0, 0, 0);}
		WaitEnemy;
		CreateEnemyFromFile(gcsd~"b1end.txt", 0, 0, 0, 0, 0);
		WaitEnemy;
		clearstage(gcsd~"002.mp3");
		Wait(240);
		if(prac){ClearStage;}
		else{stage2;}
	}

	function clearstage(let bgm)
	{
		FadeOutMusic(bgm, 30);
		loop(204){backalpha-=1.25; yield;}
		backalpha=0;
	}

	task stage1easy
	{
		PlayMusic(bgm);
		SetCommonDataEx("MusicUnlock", "Music01", 1);
		SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");
		Wait(30);
		CreateEnemyFromFile(gcsd~"bgm.txt", 0, 0, 0, 0, gcsd~"menu401.png");
		Wait(30);
		loop(51){stgalpha+=5; yield;}
		loop(51){textalpha+=5; yield;}
		loop(102){backalpha+=2.5; yield;}
		loop(51){stgalpha-=5; yield;}
		loop(51){textalpha-=5; yield;}
		Wait(60);
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		loop(7)
		{
			CreateEnemyFromFile(gcsd~"01e.txt", GetClipMinX+48+xmod, GetClipMinY, 2, 90, 0);
			xmod+=48;
			Wait(60);
		}
		Wait(60);
		xmod-=48;
		loop(7)
		{
			CreateEnemyFromFile(gcsd~"01e.txt", GetClipMinX+48+xmod, GetClipMinY, 2, 90, 0);
			xmod-=48;
			Wait(60);
		}
		Wait(60);
		xmod+=48;
		loop(7)
		{
			CreateEnemyFromFile(gcsd~"01e.txt", GetClipMinX+48+xmod, GetClipMinY, 2, 90, 0);
			CreateEnemyFromFile(gcsd~"01ae.txt", GetClipMaxX-48-xmod, GetClipMinY, 1, 90, 0);
			xmod+=48;
			Wait(60);
		}
		WaitEnemy;
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		loop(16)
		{
			CreateEnemyFromFile(gcsd~"02e.txt", GetClipMinX, GetClipMinY+rand(48, 256), rand(1, 3), rand(0, 5), rand(60, 90));
			Wait(10);
		}
		Wait(60);
		loop(16)
		{
			CreateEnemyFromFile(gcsd~"02ae.txt", GetClipMaxX, GetClipMinY+rand(48, 256), rand(1, 3), rand(175, 180), rand(60, 90));
			Wait(10);
		}
		WaitEnemy;
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyBossFromFile(gcsd~"m1plue.txt", GetClipMaxX, 0, 0, 0, 0);
		WaitEnemy;
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"02e.txt", GetClipMinX, GetClipMinY+rand(48, 128), rand(1, 3), rand(0, 5), rand(60, 90));
			CreateEnemyFromFile(gcsd~"02e.txt", GetClipMaxX, GetClipMinY+rand(48, 128), rand(1, 3), rand(175, 180), rand(60, 90));
			Wait(10);
		}
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"02ae.txt", GetClipMinX, GetClipMinY+rand(48, 128), rand(1, 3), rand(0, 5), rand(60, 90));
			CreateEnemyFromFile(gcsd~"02ae.txt", GetClipMaxX, GetClipMinY+rand(48, 128), rand(1, 3), rand(175, 180), rand(60, 90));
			Wait(10);
		}
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"02e.txt", GetClipMinX, GetClipMinY+rand(48, 128), rand(1, 3), rand(0, 5), rand(60, 90));
			CreateEnemyFromFile(gcsd~"02e.txt", GetClipMaxX, GetClipMinY+rand(48, 128), rand(1, 3), rand(175, 180), rand(60, 90));
			Wait(10);
		}
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"02ae.txt", GetClipMinX, GetClipMinY+rand(48, 128), rand(1, 3), rand(0, 5), rand(60, 90));
			CreateEnemyFromFile(gcsd~"02ae.txt", GetClipMaxX, GetClipMinY+rand(48, 128), rand(1, 3), rand(175, 180), rand(60, 90));
			Wait(10);
		}
		Wait(120);
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		xmod = 0;
		loop(7)
		{
			CreateEnemyFromFile(gcsd~"01e.txt", GetClipMaxX-48-xmod, GetClipMinY, 2, 90, 0);
			CreateEnemyFromFile(gcsd~"01ae.txt", GetClipMinX+48+xmod, GetClipMinY, 1, 90, 0);
			xmod+=48;
			Wait(30);
		}
		xmod = 0;
		loop(7)
		{
			CreateEnemyFromFile(gcsd~"01e.txt", GetClipMinX+48+xmod, GetClipMinY, 2, 90, 0);
			CreateEnemyFromFile(gcsd~"01ae.txt", GetClipMaxX-48-xmod, GetClipMinY, 1, 90, 0);
			xmod+=48;
			Wait(30);
		}
		WaitEnemy;
		//--------------------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyBossFromFile(gcsd~"b1plue.txt", GetCenterX, 0, 0, 0, 0);
		WaitEnemy;
		CreateEnemyFromFile(gcsd~"b1end.txt", 0, 0, 0, 0, 0);
		WaitEnemy;
		clearstage(gcsd~"002.mp3");
		Wait(240);
		if(prac){ClearStage;}
		else{stage2easy;}
	}

	task stage2
	{
		if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchyNormal", 1)<2){SetCommonDataEx("StageUnlock", "StagePatchyNormal", 2);}
		if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeineNormal", 1)<2){SetCommonDataEx("StageUnlock", "StageKeineNormal", 2);}
		if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChenNormal", 1)<2){SetCommonDataEx("StageUnlock", "StageChenNormal", 2);}
		SaveCommonDataEx("StageUnlock", gcsd~"DATA/MENU/STAGE.dat");
		back = gcsd~"02b.png";
		bgm = gcsd~"003.mp3";
		textpic = gcsd~"02stx.png";
		stagepic = gcsd~"02st.png";
		LoadGraphic(back);
		LoadGraphic(textpic);
		LoadGraphic(stagepic);
		LoadMusic(bgm);
		grazemark=320; 
		PlayMusic(bgm);
		SetCommonDataEx("MusicUnlock", "Music03", 1);
		SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");
		Wait(30);
		CreateEnemyFromFile(gcsd~"bgm.txt", 0, 0, 0, 0, gcsd~"menu403.png");
		Wait(30);
		loop(51){stgalpha+=5; yield;}
		loop(51){textalpha+=5; yield;}
		loop(102){backalpha+=2.5; yield;}
		loop(51){stgalpha-=5; yield;}
		loop(51){textalpha-=5; yield;}
		Wait(60);
		//------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyFromFile(gcsd~"03.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"03.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"03.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		let xmod = 0;
		loop(8)
		{
			CreateEnemyFromFile(gcsd~"01b.txt", GetClipMinX+30+xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(20);
		}
		Wait(60);
		xmod = 0;
		loop(8)
		{
			CreateEnemyFromFile(gcsd~"01b.txt", GetClipMaxX-30-xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(20);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX-150, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX+150, GetClipMinY+96, 0, 0, 0);
		Wait(20);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX-110, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX+110, GetClipMinY+96, 0, 0, 0);
		Wait(20);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX-70, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX+70, GetClipMinY+96, 0, 0, 0);
		Wait(20);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX-30, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"04.txt", GetCenterX+30, GetClipMinY+96, 0, 0, 0);
		Wait(150);
		//------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyFromFile(gcsd~"03.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"03.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"03.txt", GetCenterX-60, GetClipMinY+128, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"03.txt", GetCenterX+60, GetClipMinY+128, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"03.txt", GetCenterX, GetClipMinY+160, 0, 0, 0);
		WaitEnemy;
		Wait(120);
		//------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyFromFile(gcsd~"03a.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		Wait(90);
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(120);
		DeleteEnemyShotToItem(ALL);
		CreateEnemyBossFromFile(gcsd~"m2plun.txt", GetClipMinX, 0, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		let xmod = 0;
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01b.txt", GetClipMinX+30+xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(10);
		}
		Wait(60);
		xmod = 0;
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01b.txt", GetClipMaxX-30-xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(10);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX-80, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX-40, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX+40, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX+80, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		Wait(120);
		//------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX+80, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX-80, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX+40, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX-40, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX+80, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX-80, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"05.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(120);
		let xmod = 0;
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01b.txt", GetClipMinX+30+xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(8);
		}
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01b.txt", GetClipMinX+30+xmod, GetClipMinY, 4, 90, 0);
			xmod-=20;
			Wait(8);
		}
		Wait(60);
		xmod = 0;
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01b.txt", GetClipMaxX-30-xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(8);
		}
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01b.txt", GetClipMaxX-30-xmod, GetClipMinY, 4, 90, 0);
			xmod-=20;
			Wait(8);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		ascent(a in 0..18)
		{
			CreateEnemyFromFile(gcsd~"05.txt", GetPlayerX+160*cos(a*20), GetPlayerY+160*sin(a*20), 0, 0, 0);
		}
		Wait(150);
		DeleteEnemyShotToItem(ALL);
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(120);
		CreateEnemyBossFromFile(gcsd~"b2plun.txt", GetCenterX, 0, 0, 0, 0);
		WaitEnemy;
		if(GetGraze>=grazemark&&prac==false){Wait(120); CreateEnemyBossFromFile(gcsd~"b2lwn.txt", GetCenterX, 0, 0, 0, 0);}
		WaitEnemy;
		CreateEnemyFromFile(gcsd~"b2end.txt", 0, 0, 0, 0, 0);
		WaitEnemy;
		clearstage(gcsd~"004.mp3");
		Wait(240);
		if(prac){ClearStage;}
		else{stage3;}
	}


	task stage2easy
	{
		if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchyEasy", 1)<2){SetCommonDataEx("StageUnlock", "StagePatchyEasy", 2);}
		if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeineEasy", 1)<2){SetCommonDataEx("StageUnlock", "StageKeineEasy", 2);}
		if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChenEasy", 1)<2){SetCommonDataEx("StageUnlock", "StageChenEasy", 2);}
		SaveCommonDataEx("StageUnlock", gcsd~"DATA/MENU/STAGE.dat");
		back = gcsd~"02b.png";
		bgm = gcsd~"003.mp3";
		textpic = gcsd~"02stx.png";
		stagepic = gcsd~"02st.png";
		LoadGraphic(back);
		LoadGraphic(textpic);
		LoadGraphic(stagepic);
		LoadMusic(bgm);
		grazemark=320; 
		PlayMusic(bgm);
		SetCommonDataEx("MusicUnlock", "Music03", 1);
		SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");
		Wait(30);
		CreateEnemyFromFile(gcsd~"bgm.txt", 0, 0, 0, 0, gcsd~"menu403.png");
		Wait(30);
		loop(51){stgalpha+=5; yield;}
		loop(51){textalpha+=5; yield;}
		loop(102){backalpha+=2.5; yield;}
		loop(51){stgalpha-=5; yield;}
		loop(51){textalpha-=5; yield;}
		Wait(60);
		//------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyFromFile(gcsd~"03e.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"03e.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"03e.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		let xmod = 0;
		loop(8)
		{
			CreateEnemyFromFile(gcsd~"01be.txt", GetClipMinX+30+xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(20);
		}
		Wait(60);
		xmod = 0;
		loop(8)
		{
			CreateEnemyFromFile(gcsd~"01be.txt", GetClipMaxX-30-xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(20);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX-150, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX+150, GetClipMinY+96, 0, 0, 0);
		Wait(20);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX-110, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX+110, GetClipMinY+96, 0, 0, 0);
		Wait(20);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX-70, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX+70, GetClipMinY+96, 0, 0, 0);
		Wait(20);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX-30, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"04e.txt", GetCenterX+30, GetClipMinY+96, 0, 0, 0);
		Wait(150);
		//------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyFromFile(gcsd~"03e.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"03e.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"03e.txt", GetCenterX-60, GetClipMinY+128, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"03e.txt", GetCenterX+60, GetClipMinY+128, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"03e.txt", GetCenterX, GetClipMinY+160, 0, 0, 0);
		WaitEnemy;
		Wait(120);
		//------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyFromFile(gcsd~"03ae.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		Wait(90);
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(120);
		DeleteEnemyShotToItem(ALL);
		CreateEnemyBossFromFile(gcsd~"m2plue.txt", GetClipMinX, 0, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		let xmod = 0;
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01be.txt", GetClipMinX+30+xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(10);
		}
		Wait(60);
		xmod = 0;
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01be.txt", GetClipMaxX-30-xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(10);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX-80, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX-40, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX+40, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX+80, GetClipMinY+96, 0, 0, 0);
		Wait(30);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		Wait(120);
		//------------------------------------------------------------------------------------------------------------------------------------------
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX+80, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX-80, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX+120, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX-120, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX+40, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX-40, GetClipMinY+96, 0, 0, 0);
		Wait(60);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX+80, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX-80, GetClipMinY+96, 0, 0, 0);
		CreateEnemyFromFile(gcsd~"05e.txt", GetCenterX, GetClipMinY+96, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(120);
		let xmod = 0;
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01be.txt", GetClipMinX+30+xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(8);
		}
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01be.txt", GetClipMinX+30+xmod, GetClipMinY, 4, 90, 0);
			xmod-=20;
			Wait(8);
		}
		Wait(60);
		xmod = 0;
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01be.txt", GetClipMaxX-30-xmod, GetClipMinY, 4, 90, 0);
			xmod+=20;
			Wait(8);
		}
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"01be.txt", GetClipMaxX-30-xmod, GetClipMinY, 4, 90, 0);
			xmod-=20;
			Wait(8);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		ascent(a in 0..18)
		{
			CreateEnemyFromFile(gcsd~"05e.txt", GetPlayerX+160*cos(a*20), GetPlayerY+160*sin(a*20), 0, 0, 0);
		}
		Wait(150);
		DeleteEnemyShotToItem(ALL);
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(120);
		CreateEnemyBossFromFile(gcsd~"b2plue.txt", GetCenterX, 0, 0, 0, 0);
		WaitEnemy;
		CreateEnemyFromFile(gcsd~"b2end.txt", 0, 0, 0, 0, 0);
		WaitEnemy;
		clearstage(gcsd~"004.mp3");
		Wait(240);
		if(prac){ClearStage;}
		else{stage3easy;}
	}


	task stage3
	{
		if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchyNormal", 1)<3){SetCommonDataEx("StageUnlock", "StagePatchyNormal", 3);}
		if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeineNormal", 1)<3){SetCommonDataEx("StageUnlock", "StageKeineNormal", 3);}
		if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChenNormal", 1)<3){SetCommonDataEx("StageUnlock", "StageChenNormal", 3);}
		SaveCommonDataEx("StageUnlock", gcsd~"DATA/MENU/STAGE.dat");
		back = gcsd~"03b.png";
		bgm = gcsd~"005.mp3";
		textpic = gcsd~"03stx.png";
		stagepic = gcsd~"03st.png";
		LoadGraphic(back);
		LoadGraphic(textpic);
		LoadGraphic(stagepic);
		LoadMusic(bgm);
		grazemark=750; 
		PlayMusic(bgm);
		SetCommonDataEx("MusicUnlock", "Music05", 1);
		SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");
		Wait(30);
		CreateEnemyFromFile(gcsd~"bgm.txt", 0, 0, 0, 0, gcsd~"menu405.png");
		Wait(30);
		loop(51){stgalpha+=5; yield;}
		loop(51){textalpha+=5; yield;}
		loop(204){backalpha+=1.25; yield;}
		loop(51){stgalpha-=5; yield;}
		loop(51){textalpha-=5; yield;}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		let xmod = 32;
		loop(11)
		{
			CreateEnemyFromFile(gcsd~"06.txt", GetClipMinX+xmod+rand(-8, 8), rand(GetClipMinY+32, GetClipMinY+64), 0, 0, -1);
			CreateEnemyFromFile(gcsd~"06.txt", GetClipMaxX-xmod+rand(-8, 8), rand(GetClipMinY+32, GetClipMinY+96), 0, 0, rand(0, 360));
			xmod+=32;
			Wait(30);
		}
		let xmod = 32;
		Wait(60);
		loop(11)
		{
			CreateEnemyFromFile(gcsd~"06.txt", GetClipMaxX-xmod+rand(-8, 8), rand(GetClipMinY+32, GetClipMinY+64), 0, 0, -1);
			CreateEnemyFromFile(gcsd~"06.txt", GetClipMinX+xmod+rand(-8, 8), rand(GetClipMinY+32, GetClipMinY+96), 0, 0, rand(0, 360));
			xmod+=32;
			Wait(30);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(120);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07.txt", GetClipMinX, GetClipMinY+96, 3, 0, true);
			Wait(10);
		}
		Wait(60);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07.txt", GetClipMaxX, GetClipMinY+96, 3, 180, false);
			Wait(10);
		}
		Wait(60);
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07.txt", GetClipMinX, GetClipMinY+96, 3, 0, true);
			CreateEnemyFromFile(gcsd~"07.txt", GetClipMaxX, GetClipMinY+96, 3, 180, false);
			Wait(10);
		}
		Wait(120);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07.txt", GetClipMinX, GetClipMinY+96, 3, 0, true);
			CreateEnemyFromFile(gcsd~"07.txt", GetClipMaxX, GetClipMinY+96, 3, 180, false);
			Wait(10);
		}
		Wait(120);
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		loop(32)
		{
			CreateEnemyFromFile(gcsd~"06.txt", rand(GetClipMinX+32, GetClipMaxX-32), rand(GetClipMinY+32, GetCenterY-32), 0, 0, rand(0, 360));
			Wait(10);
			CreateEnemyFromFile(gcsd~"06.txt", rand(GetClipMinX+32, GetClipMaxX-32), rand(GetClipMinY+32, GetCenterY-32), 0, 0, -1);
			Wait(10);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(120);
		CreateEnemyFromFile(gcsd~"08.txt", GetCenterX-128, GetClipMinY, 6, 90, 0);
		Wait(180);
		CreateEnemyFromFile(gcsd~"08.txt", GetCenterX+128, GetClipMinY, 6, 90, 180);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(180);
		CreateEnemyFromFile(gcsd~"08a.txt", GetCenterX-128, GetClipMinY, 6, 90, 0);
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"06.txt", rand(GetCenterX, GetClipMaxX-32), rand(GetClipMinY+32, GetCenterY-32), 0, 0, rand(0, 360));
			Wait(20);
		}
		Wait(180);
		CreateEnemyFromFile(gcsd~"08.txt", GetCenterX+128, GetClipMinY, 6, 90, 180);
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"06.txt", rand(GetClipMinX+32, GetCenterX), rand(GetClipMinY+32, GetCenterY-32), 0, 0, rand(0, 360));
			Wait(20);
		}
		Wait(120);
		//------------------------------------------------------------------------------------------------------------------------------------------
		WaitEnemy;
		Wait(120);
		CreateEnemyBossFromFile(gcsd~"m3plun.txt", 0, GetClipMinY+120, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyFromFile(gcsd~"08a.txt", GetCenterX-128, GetClipMinY, 6, 90, 0);
		CreateEnemyFromFile(gcsd~"08.txt", GetCenterX+128, GetClipMinY, 6, 90, 180);
		WaitEnemy;
		CreateEnemyFromFile(gcsd~"08.txt", GetCenterX-128, GetClipMinY, 6, 90, 0);
		CreateEnemyFromFile(gcsd~"08a.txt", GetCenterX+128, GetClipMinY, 6, 90, 180);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		loop(64)
		{
			CreateEnemyFromFile(gcsd~"06.txt", rand(GetClipMinX+32, GetClipMaxX-32), rand(GetClipMinY+32, GetCenterY-32), 0, 0, rand(0, 360));
			Wait(10);
			CreateEnemyFromFile(gcsd~"06.txt", rand(GetClipMinX+32, GetClipMaxX-32), rand(GetClipMinY+32, GetCenterY-32), 0, 0, -1);
			Wait(10);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(180);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07.txt", GetClipMinX, GetClipMinY+96, 3, 0, true);
			Wait(5);
			CreateEnemyFromFile(gcsd~"07.txt", GetClipMaxX, GetClipMinY+96, 3, 180, false);
			Wait(5);
		}
		Wait(120);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07.txt", GetClipMaxX, GetClipMinY+96, 3, 180, false);
			Wait(5);
			CreateEnemyFromFile(gcsd~"07.txt", GetClipMinX, GetClipMinY+96, 3, 0, true);
			Wait(5);
		}
		Wait(120);
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyFromFile(gcsd~"08a.txt", GetCenterX-128, GetClipMinY, 6, 90, 0);
		CreateEnemyFromFile(gcsd~"08a.txt", GetCenterX, GetClipMinY, 6, 90, -90);
		CreateEnemyFromFile(gcsd~"08a.txt", GetCenterX+128, GetClipMinY, 6, 90, 180);
		//------------------------------------------------------------------------------------------------------------------------------------------
		WaitEnemy;
		Wait(120);
		CreateEnemyBossFromFile(gcsd~"b3plun.txt", GetCenterX, 0, 0, 0, 0);
		WaitEnemy;
		if(GetGraze>=grazemark&&prac==false){Wait(60); CreateEnemyBossFromFile(gcsd~"b3lwn.txt", GetCenterX, 0, 0, 0, 0);}
		WaitEnemy;
		CreateEnemyFromFile(gcsd~"b3end.txt", 0, 0, 0, 0, 0);
		WaitEnemy;
		clearstage(gcsd~"006.mp3");
		Wait(240);
		if(prac){ClearStage;}
		else
		{
			let i = 7;
			while(i<length(cdrot)){SetCommonDataEx("MusicUnlock", "Music"~cdrot[i], 1); i++;}
			SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");
			ClearStage;
		}
	}


	task stage3easy
	{
		if(GetPlayerScriptName == "patchy.txt"&&GetCommonDataDefaultEx("StageUnlock", "StagePatchyEasy", 1)<3){SetCommonDataEx("StageUnlock", "StagePatchyEasy", 3);}
		if(GetPlayerScriptName == "keine.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageKeineEasy", 1)<3){SetCommonDataEx("StageUnlock", "StageKeineEasy", 3);}
		if(GetPlayerScriptName == "chen.txt"&&GetCommonDataDefaultEx("StageUnlock", "StageChenEasy", 1)<3){SetCommonDataEx("StageUnlock", "StageChenEasy", 3);}
		SaveCommonDataEx("StageUnlock", gcsd~"DATA/MENU/STAGE.dat");
		back = gcsd~"03b.png";
		bgm = gcsd~"005.mp3";
		textpic = gcsd~"03stx.png";
		stagepic = gcsd~"03st.png";
		LoadGraphic(back);
		LoadGraphic(textpic);
		LoadGraphic(stagepic);
		LoadMusic(bgm);
		grazemark=750; 
		PlayMusic(bgm);
		SetCommonDataEx("MusicUnlock", "Music05", 1);
		SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");
		Wait(30);
		CreateEnemyFromFile(gcsd~"bgm.txt", 0, 0, 0, 0, gcsd~"menu405.png");
		Wait(30);
		loop(51){stgalpha+=5; yield;}
		loop(51){textalpha+=5; yield;}
		loop(204){backalpha+=1.25; yield;}
		loop(51){stgalpha-=5; yield;}
		loop(51){textalpha-=5; yield;}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		let xmod = 32;
		loop(11)
		{
			CreateEnemyFromFile(gcsd~"06e.txt", GetClipMinX+xmod+rand(-8, 8), rand(GetClipMinY+32, GetClipMinY+64), 0, 0, -1);
			CreateEnemyFromFile(gcsd~"06e.txt", GetClipMaxX-xmod+rand(-8, 8), rand(GetClipMinY+32, GetClipMinY+96), 0, 0, rand(0, 360));
			xmod+=32;
			Wait(30);
		}
		let xmod = 32;
		Wait(60);
		loop(11)
		{
			CreateEnemyFromFile(gcsd~"06e.txt", GetClipMaxX-xmod+rand(-8, 8), rand(GetClipMinY+32, GetClipMinY+64), 0, 0, -1);
			CreateEnemyFromFile(gcsd~"06e.txt", GetClipMinX+xmod+rand(-8, 8), rand(GetClipMinY+32, GetClipMinY+96), 0, 0, rand(0, 360));
			xmod+=32;
			Wait(30);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(120);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07e.txt", GetClipMinX, GetClipMinY+96, 3, 0, true);
			Wait(10);
		}
		Wait(60);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07e.txt", GetClipMaxX, GetClipMinY+96, 3, 180, false);
			Wait(10);
		}
		Wait(60);
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07e.txt", GetClipMinX, GetClipMinY+96, 3, 0, true);
			CreateEnemyFromFile(gcsd~"07e.txt", GetClipMaxX, GetClipMinY+96, 3, 180, false);
			Wait(10);
		}
		Wait(120);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07e.txt", GetClipMinX, GetClipMinY+96, 3, 0, true);
			CreateEnemyFromFile(gcsd~"07e.txt", GetClipMaxX, GetClipMinY+96, 3, 180, false);
			Wait(10);
		}
		Wait(120);
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		loop(32)
		{
			CreateEnemyFromFile(gcsd~"06e.txt", rand(GetClipMinX+32, GetClipMaxX-32), rand(GetClipMinY+32, GetCenterY-32), 0, 0, rand(0, 360));
			Wait(10);
			CreateEnemyFromFile(gcsd~"06e.txt", rand(GetClipMinX+32, GetClipMaxX-32), rand(GetClipMinY+32, GetCenterY-32), 0, 0, -1);
			Wait(10);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(120);
		CreateEnemyFromFile(gcsd~"08e.txt", GetCenterX-128, GetClipMinY, 6, 90, 0);
		Wait(180);
		CreateEnemyFromFile(gcsd~"08e.txt", GetCenterX+128, GetClipMinY, 6, 90, 180);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(180);
		CreateEnemyFromFile(gcsd~"08ae.txt", GetCenterX-128, GetClipMinY, 6, 90, 0);
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"06e.txt", rand(GetCenterX, GetClipMaxX-32), rand(GetClipMinY+32, GetCenterY-32), 0, 0, rand(0, 360));
			Wait(20);
		}
		Wait(180);
		CreateEnemyFromFile(gcsd~"08e.txt", GetCenterX+128, GetClipMinY, 6, 90, 180);
		loop(12)
		{
			CreateEnemyFromFile(gcsd~"06e.txt", rand(GetClipMinX+32, GetCenterX), rand(GetClipMinY+32, GetCenterY-32), 0, 0, rand(0, 360));
			Wait(20);
		}
		Wait(120);
		//------------------------------------------------------------------------------------------------------------------------------------------
		WaitEnemy;
		Wait(120);
		CreateEnemyBossFromFile(gcsd~"m3plue.txt", 0, GetClipMinY+120, 0, 0, 0);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyFromFile(gcsd~"08ae.txt", GetCenterX-128, GetClipMinY, 6, 90, 0);
		CreateEnemyFromFile(gcsd~"08e.txt", GetCenterX+128, GetClipMinY, 6, 90, 180);
		WaitEnemy;
		CreateEnemyFromFile(gcsd~"08e.txt", GetCenterX-128, GetClipMinY, 6, 90, 0);
		CreateEnemyFromFile(gcsd~"08ae.txt", GetCenterX+128, GetClipMinY, 6, 90, 180);
		WaitEnemy;
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		loop(64)
		{
			CreateEnemyFromFile(gcsd~"06e.txt", rand(GetClipMinX+32, GetClipMaxX-32), rand(GetClipMinY+32, GetCenterY-32), 0, 0, rand(0, 360));
			Wait(10);
			CreateEnemyFromFile(gcsd~"06e.txt", rand(GetClipMinX+32, GetClipMaxX-32), rand(GetClipMinY+32, GetCenterY-32), 0, 0, -1);
			Wait(10);
		}
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(180);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07e.txt", GetClipMinX, GetClipMinY+96, 3, 0, true);
			Wait(5);
			CreateEnemyFromFile(gcsd~"07e.txt", GetClipMaxX, GetClipMinY+96, 3, 180, false);
			Wait(5);
		}
		Wait(120);
		loop(20)
		{
			CreateEnemyFromFile(gcsd~"07e.txt", GetClipMaxX, GetClipMinY+96, 3, 180, false);
			Wait(5);
			CreateEnemyFromFile(gcsd~"07e.txt", GetClipMinX, GetClipMinY+96, 3, 0, true);
			Wait(5);
		}
		Wait(120);
		//------------------------------------------------------------------------------------------------------------------------------------------
		Wait(60);
		CreateEnemyFromFile(gcsd~"08ae.txt", GetCenterX-128, GetClipMinY, 6, 90, 0);
		CreateEnemyFromFile(gcsd~"08ae.txt", GetCenterX, GetClipMinY, 6, 90, -90);
		CreateEnemyFromFile(gcsd~"08ae.txt", GetCenterX+128, GetClipMinY, 6, 90, 180);
		//------------------------------------------------------------------------------------------------------------------------------------------
		WaitEnemy;
		Wait(120);
		CreateEnemyBossFromFile(gcsd~"b3plue.txt", GetCenterX, 0, 0, 0, 0);
		WaitEnemy;
		CreateEnemyFromFile(gcsd~"b3end.txt", 0, 0, 0, 0, 0);
		WaitEnemy;
		clearstage(gcsd~"006.mp3");
		Wait(240);
		if(prac){ClearStage;}
		else
		{
			let i = 7;
			while(i<length(cdrot)){SetCommonDataEx("MusicUnlock", "Music"~cdrot[i], 1); i++;}
			SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");
			ClearStage;
		}
	}
}