
	task TASK_MENU
	{
		if(StageState==Menu)
		{
			ForbidShot(true);
			ForbidBomb(true);
			SetPlayerX(DefaultX);
			SetPlayerY(DefaultY);
		}
/////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////メニュー部//////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
		if(MenuState==Menu)
		{
			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=1999)
				{
					Select=2004;
				}
				if(Select==Extra && GetCommonDataDefaultEx(NsScore,"ExFlag","false")=="false")
				{
					Select-=1;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select==Extra && GetCommonDataDefaultEx(NsScore,"ExFlag","false")=="false")
				{
					Select+=1;
				}
				if(Select>=2005)
				{
					Select=2000;
				}
			}
			if(GetKeyState(VK_RIGHT) == KEY_PUSH && GetCommonDataDefaultEx(NsScore,"SecretFlag","false")=="true")
			{
				PlaySE(MenuSE[0]);
				Select=2005;
			}
			if(GetKeyState(VK_LEFT) == KEY_PUSH && GetCommonDataDefaultEx(NsScore,"SecretFlag","false")=="true")
			{
				PlaySE(MenuSE[0]);
				Select=2000;
			}
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				Select=Quit;
			}		

			if(Select==Start && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=MenuDifficult;
				Select=EASY;
				wait(5);
			}

			if(Select==Extra && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
			//	MenuState=MenuExtra;
				PlaySE(MenuSE[0]);
				StageState=Exit;
				SelectedDifficult="Extra";
				SetCommonData("STARTPOWER",5000);
				wait(5);
				SetCommonData("STARTPOWER",0);
			}

			if(Select==Practice && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=MenuPractice;
				Select=3500;
				wait(5);
			}

			if(Select==Result && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=MenuResult;
				Select=5000;
				wait(5);
			}
			if(Select==Quit && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				ClearStage();
			}
			if(Select==Secret && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=MenuSecret;
				wait(5);
			}

		}
///////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////難易度選択部///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
		if(MenuState==MenuDifficult)
		{
			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=2999)
				{
					Select=3003;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select>=3004)
				{
					Select=3000;
				}
			}
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=Menu;
				Select=2000;
			}
			if(Select==EASY && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StageState=Exit;
				SelectedDifficult="Easy";
			}

			if(Select==NORMAL && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StageState=Exit;
				SelectedDifficult="Normal";
			}

			if(Select==HARD && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StageState=Exit;
				SelectedDifficult="Hard";
			}

			if(Select==LUNATIC && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StageState=Exit;
				SelectedDifficult="Lunatic";
			}
		}
///////////////////////////////////////////////////////////////////////////////
/////////////////////////////プラクティス部//////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
		if(MenuState==MenuPractice)
		{
			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=3499)
				{
					Select=3503;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select>=3504)
				{
					Select=3500;
				}
			}
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=Menu;
				Select=2000;
			}
			if(Select==EASYPRACTICE && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				SelectedDifficult="Easy";
				MenuState=MenuPracticeStage;
				Select=4000;
				wait(5);
			}

			if(Select==NORMALPRACTICE && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				SelectedDifficult="Normal";
				MenuState=MenuPracticeStage;
				Select=4000;
				wait(5);
			}

			if(Select==HARDPRACTICE && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				SelectedDifficult="Hard";
				MenuState=MenuPracticeStage;
				Select=4000;
				wait(5);
			}

			if(Select==LUNATICPRACTICE && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				SelectedDifficult="Lunatic";
				MenuState=MenuPracticeStage;
				Select=4000;
				wait(5);
			}
			if(Select==SPELLCARDPRACTICE && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=SpellcardPracticeStageSelect;
				Select=SpellcardPracticeStage1;
				wait(5);
			}
		}
		if(MenuState==MenuPracticeStage)
		{
			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=3999)
				{
					Select=4005;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select>=4006)
				{
					Select=4000;
				}
			}
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=MenuPractice;
				Select=3500;
			}
			if(Select==STAGE1 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=1;
				StageState=Exit;
			}
			if(Select==STAGE2 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=2;
				StageState=Exit;
			}
			if(Select==STAGE3 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=3;
				StageState=Exit;
			}
			if(Select==STAGE4 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=4;
				StageState=Exit;
			}
			if(Select==STAGE5 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=5;
				StageState=Exit;
			}
			if(Select==STAGE6 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=6;
				StageState=Exit;
			}
		}
//////////////////////////////////////////////////////////////////////////////////
/////////////////////////スペルカードプラクティス部//////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
		if(MenuState==SpellcardPracticeStageSelect)
		{
			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=60000)
				{
					Select=60006;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select>=60007)
				{
					Select=60001;
				}
			}
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=MenuPractice;
				Select=3500;
			}
			if(Select==SpellcardPracticeStage1 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=SpellcardPracticeStage1List;
			}
			if(Select==STAGE2 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=2;
				StageState=Exit;
			}
			if(Select==STAGE3 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=3;
				StageState=Exit;
			}
			if(Select==STAGE4 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=4;
				StageState=Exit;
			}
			if(Select==STAGE5 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=5;
				StageState=Exit;
			}
			if(Select==STAGE6 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StagePractice=true;
				StageProgress=6;
				StageState=Exit;
			}
		}


		if(MenuState==SpellcardPracticeStage1List)
		{
			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=80000)
				{
					Select=80010;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select>=80011)
				{
					Select=80001;
				}
			}
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=MenuPractice;
				Select=3500;
			}
			if(Select==SpellCardPracticeNo[1] && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
			//	PlaySE(MenuSE[0]);
			//	MenuState=SpellcardPracticeStage1List;
			}
		}


















////////////////////////////////////////////////////////////////////////////////
///////////////////////////リザルト部///////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
		if(MenuState==MenuResult)
		{
			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=4999)
				{
					Select=5002;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select>=5003)
				{
					Select=5000;
				}
			}
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=Menu;
				Select=2000;
			}


			if(Select==ResultSCORE && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=ViewResultScore;
				ResultScoreState=6000;
				wait(5);
			}

			if(Select==ResultSPELL && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=ViewResultSpell;
				ResultSpellState=10000;
				wait(5);
			}

			if(Select==ResultOTHERS && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=ResultOTHERS;
				wait(5);
			}
		}
//////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////スコアリザルト部///////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
		if(MenuState==ViewResultScore)
		{
			if(GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=ViewResultSpell;
				ResultScoreState=0;
				ResultSpellState=10000;
				wait(5);
			}

			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=MenuResult;
				ResultScoreState=0;
				Select=5000;
				wait(5);
			}

			if(GetKeyState(VK_LEFT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				ResultScoreState-=1;
				if(ResultScoreState%10==9)
				{
					ResultScoreState+=5;//EX表示するには５にする
				}
				wait(5);
			}

			if(GetKeyState(VK_RIGHT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				ResultScoreState+=1;
				if(ResultScoreState%10==5)//EX表示するには５にする
				{
					ResultScoreState-=5;//EX表示するには５にする
				}
				wait(5);
			}

			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				ResultScoreState-=100;
				if(ResultScoreState<6000)
				{
					ResultScoreState+=400;
				}
				wait(5);
			}

			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				ResultScoreState+=100;
				if(ResultScoreState>=6400)
				{
					ResultScoreState-=400;
				}
				wait(5);
			}
		}
/////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////スペルカード戦歴部/////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
		if(MenuState==ViewResultSpell)
		{
			if(GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=ViewResultScore;
				ResultScoreState=6000;
				ResultSpellState=0;
				wait(5);
			}
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=MenuResult;
				ResultSpellState=0;
				Select=5000;
				wait(5);
			}

			if(GetKeyState(VK_LEFT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				ResultSpellState-=1;
				if(ResultSpellState%100==99)
				{
					ResultSpellState+=17;
				}
				wait(5);
			}

			if(GetKeyState(VK_RIGHT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				ResultSpellState+=1;
				if(ResultSpellState%100==17)
				{
					ResultSpellState-=17;
				}
				wait(5);
			}

			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				ResultSpellState-=100;
				if(ResultSpellState<10000)
				{
					ResultSpellState+=500;
				}
				wait(5);
			}

			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				ResultSpellState+=100;
				if(ResultSpellState>=10500)
				{
					ResultSpellState-=500;
				}
				wait(5);
			}
		}
////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////シークレット部/////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
		if(MenuState==MenuSecret)
		{
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=Menu;
				Select=2000;
			}
			if(GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				MenuState=SecretSpell;
				Select=SecretSpell1;
				SecretSpellSelect=SecretSpell1;
				wait(5);
			}
		}
		if(MenuState==SecretSpell)
		{
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=MenuSecret;
			}
			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=20000)
				{
					Select=20002;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select>=20003)
				{
					Select=20001;
				}
			}
			if(Select==SecretSpell1 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StageState=Exit;
				SelectedDifficult="SecretSpell";
				SecretSpellSelect=SecretSpell1;
			}
			if(Select==SecretSpell2 && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				StageState=Exit;
				SelectedDifficult="SecretSpell";
				SecretSpellSelect=SecretSpell2;
			}
		}
/////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////その他部///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
		if(MenuState==ResultOTHERS)
		{
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=MenuResult;
				Select=5000;
				wait(5);
			}
		}
///////////////////////////////////////////////////////////////////////////////////////
	}