
	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)
				{
					Select-=1;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select==Extra)
				{
					Select+=1;
				}
				if(Select>=2005)
				{
					Select=2000;
				}
			}
			if(GetKeyState(VK_RIGHT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select==Extra)
				{
					Select+=1;
				}
				if(Select>=2005)
				{
					Select=2000;
				}
			}
			if(GetKeyState(VK_LEFT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=1999)
				{
					Select=2004;
				}
				if(Select==Extra)
				{
					Select-=1;
				}
			}
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				Select=Quit;
			}		

			if(Select==Start && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				alternative(StartDifficult)
				case(0)
				{
					PlaySE(MenuSE[0]);
					MenuState=MenuDifficult;
					Select=EASY;
				}
				case(1)
				{
					PlaySE(MenuSE[0]);
					StageState=Exit;
					SelectedDifficult="Moderate";
				}
				case(2)
				{
					PlaySE(MenuSE[0]);
					StageState=Exit;
					SelectedDifficult="Extream";
				}
				case(3)
				{
					PlaySE(MenuSE[0]);
					StageState=Exit;
					SelectedDifficult="Apocalypse";
				}
				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=3002;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select>=3003)
				{
					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="Moderate";
			}

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

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

			if(Select==LUNATIC && GetKeyState(VK_SHOT) == KEY_PUSH)
			{

			}
		}
///////////////////////////////////////////////////////////////////////////////
/////////////////////////////プラクティス部//////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
		if(MenuState==MenuPractice)
		{
				alternative(StartDifficult)
				case(1)
				{
					PlaySE(MenuSE[0]);
					MenuState=MenuPracticeStage;
					SelectedDifficult="Moderate";
					Select=4000;
				}
				case(2)
				{
					PlaySE(MenuSE[0]);
					MenuState=MenuPracticeStage;
					SelectedDifficult="Extream";
					Select=4000;
				}
				case(3)
				{
					PlaySE(MenuSE[0]);
					MenuState=MenuPracticeStage;
					SelectedDifficult="Apocalypse";
					Select=4000;
				}

			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=3499)
				{
					Select=3502;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select>=3503)
				{
					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="Moderate";
				MenuState=MenuPracticeStage;
				Select=4000;
				wait(5);
			}

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

			if(Select==HARDPRACTICE && GetKeyState(VK_SHOT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				SelectedDifficult="Apocalypse";
				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)
		{
			alternative(StartStage)
			case(1)
			{
				StagePractice=true;
				StageProgress=1;
				StageState=Exit;
			}
			case(2)
			{
				StagePractice=true;
				StageProgress=2;
				StageState=Exit;
			}
			case(3)
			{
				StagePractice=true;
				StageProgress=3;
				StageState=Exit;
			}
			case(4)
			{
				StagePractice=true;
				StageProgress=4;
				StageState=Exit;
			}
			case(5)
			{
				StagePractice=true;
				StageProgress=5;
				StageState=Exit;
			}
			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select-=1;
				if(Select<=3999)
				{
					Select=4004;
				}
			}
			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				Select+=1;
				if(Select>=4005)
				{
					Select=4000;
				}
			}
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				if(StartDifficult==0)
				{
				MenuState=MenuPractice;
				Select=3500;
				}
				else
				{
				MenuState=Menu;
				Select=2000;
				}
			}
			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==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=ViewAchievement;
				AchievementState=100;
				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)
			{

			}

			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+=3;//EX表示するには５にする
				}
				wait(5);
			}

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

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

			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				ResultScoreState+=100;
				if(ResultScoreState>=6200)
				{
					ResultScoreState-=200;
				}
				wait(5);
			}
		}
/////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////実績部///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
		if(MenuState==ViewAchievement)
		{
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=MenuResult;
				Select=5000;
				wait(5);
			}

			if(GetKeyState(VK_LEFT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				AchievementState-=100;
				if(AchievementState<100)
				{
					AchievementState+=300;
				}
				wait(5);
			}

			if(GetKeyState(VK_RIGHT) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				AchievementState+=100;
				if(AchievementState>=400)
				{
					AchievementState-=300;
				}
				wait(5);
			}

			if(GetKeyState(VK_UP) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				AchievementState-=1;
				if(AchievementState%10==9)
				{
					AchievementState+=10;
				}
				wait(5);
			}

			if(GetKeyState(VK_DOWN) == KEY_PUSH)
			{
				PlaySE(MenuSE[0]);
				AchievementState+=1;
				if(AchievementState%10==0)
				{
					AchievementState-=10;
				}
				wait(5);
			}

		}

/////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////その他部///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
		if(MenuState==ResultOTHERS)
		{
			if(GetKeyState(VK_BOMB) == KEY_PUSH)
			{
				PlaySE(MenuSE[1]);
				MenuState=MenuResult;
				Select=5000;
				wait(5);
			}
		}
///////////////////////////////////////////////////////////////////////////////////////
	}