let townMenuY=0;function town(){if(bgmSwitch===BGM_OFF){bgmSwitch=BGM_ON;playBgm(Sounds.BGM_TOWN);backScene=BS_TOWN;for(let num=0;num<CHARA_NUM_MAX;num++){charaHp[num]=charaMaxHp[num];charaState[num]=P_STATE_NOMAL}} if(dungeon_count<DUNGEON_MAX){drawImg(Graphs.BG_TOWN,0,0)}else{drawImg(Graphs.BG_TOWN2,0,0)} fText("【レクスヘイブンの街】",500,45,25,colorRGB(255,255,255));fText("冒険開始から"+day_num+"日目",500,75,25,colorRGB(255,255,255));drawImg(Graphs.KEY_ESC,0,0);fText("タイトルに戻る",105,14,16,colorRGB(64,255,64));drawImg(Graphs.KEY_I,100+400,320);drawImg(Graphs.KEY_K,100+400,350);fText("↑↓",215+400,350,16,colorRGB(64,255,64));drawImg(Graphs.KEY_SPACE,100+400,390);fText("決定",215+400,400,16,colorRGB(64,255,64));fText("GOLD:"+gold+"G",520,450,30,colorRGB(255,255,150));if(key[27]===1){key[27]=2;playSE(Sounds.SE_ESC);stopBgm();bgmSwitch=BGM_OFF;gameScene=SCENE_TITLE;backScene=BS_TITLE} let text=["パーティ編成","装備変更","ステータス","武器屋","宿屋","レベルの館","アイテム","キー設定・その他","難易度選択","セーブ","ダンジョンへ"+"("+dungeon_count+")"];let tm_max=11;townMenuY=selectMenuY(townMenuY,tm_max);let color;for(let num=0;num<text.length;num++){if(num===townMenuY){color=colorRGB(255,64,64)}else{color=colorRGB(255,255,255)} fText(text[num],115,50+35*num,25,color)} if(key[32]===1||key[13]===1){key[32]=2;key[13]=2;switch(townMenuY){case 0:gameScene=SCENE_SET_PARTY;initSetParty();break;case 1:gameScene=SCENE_EQUIPMENT;break;case 2:gameScene=SCENE_STATES;break;case 3:gameScene=SCENE_SHOP;break;case 4:gameScene=SCENE_INN;break;case 5:gameScene=SCENE_LV_SHOP;break;case 6:gameScene=SCENE_ITEM;break;case 7:gameScene=SCENE_KEYCONFIG;break;case 8:gameScene=SCENE_DIFFICULTY;break;case 9:gameScene=SCENE_SAVE;saveY=1;break;case 10:if(charaPosition[0]===CHARA_WAIT&&charaPosition[1]===CHARA_WAIT&&charaPosition[2]===CHARA_WAIT){playSE(Sounds.SE_ESC);break}else if(dungeon_count<DUNGEON_MAX){gameScene=SCENE_GO_TO_DUNGEON}else{playSE(Sounds.SE_ESC)} break} playSE(Sounds.SE_SPACE)}} let dungeonY=0;function goToDungeon(){drawImg(Graphs.BG_TOWN,0,0);fText("【ダンジョンへ】",500,45,25,colorRGB(255,255,255));dungeonY=selectMenuY(dungeonY,area_flag);let num2=[[1],[2,1],[3,2,1],[4,3,2,1]];let color;for(let num=0;num<num2[area_flag-1].length;num++){if(dungeonY===num){color=colorRGB(255,64,64);dungeonNum=num2[area_flag-1][num]}else{color=colorRGB(255,255,255)} fText("第"+num2[area_flag-1][num]+"階層",300,200+num*30,25,color)} drawImg(Graphs.KEY_ESC,0,0);fText("タイトルに戻る",105,14,16,colorRGB(64,255,64));drawImg(Graphs.KEY_I,560,200);drawImg(Graphs.KEY_K,560,230);fText("↑↓",560+50,210+25,16,colorRGB(64,255,64));drawImg(Graphs.KEY_SPACE,560,300);fText("ダンジョンへ行く",560,340,16,colorRGB(64,255,64));drawImg(Graphs.KEY_F,560,260);fText("戻る",560+50,240+35,16,colorRGB(64,255,64));if(key[32]===1||key[13]===1){if(dungeon_count<DUNGEON_MAX){dungeon_count++;key[32]=2;key[13]=2;playSE(Sounds.SE_SPACE);recalcCharaNumMaxFromPositions();gameScene=SCENE_DUNGEON;backScene=BS_DUNGEON;myPointX=allFirstXY[dungeonNum-1][0]*CHIP_SIZE;myPointY=allFirstXY[dungeonNum-1][1]*CHIP_SIZE;encountCount=0;stopBgm();bgmSwitch=BGM_OFF}} if(key[70]===1){key[70]=2;gameScene=SCENE_TOWN;playSE(Sounds.SE_ESC)} if(key[27]===1){key[27]=2;statesX=0;playSE(Sounds.SE_ESC);stopBgm();bgmSwitch=BGM_OFF;gameScene=SCENE_TITLE;backScene=BS_TITLE}}