async function setup(){canvasSize(DISPLAY_SIZE_X,DISPLAY_SIZE_Y);setFPS(GAME_FPS);await Promise.all([loadGraphs(),loadSounds()]);clear_flag=0;clear_flag=loadLS(0);initEffect();document.dispatchEvent(new Event('game-ready'))} let down_timer=0;function mainloop(){timer++;switch(gameScene){case SCENE_P_ATTACK:drawBattleBg();battleTimer();drawEnemy();drawEffect();drawHitNum();drawBattlePlayers();drawNowWord();inputNowWord();inputAuto();moveAlphabet();enemyPp();if(enemy.state===E_DELETE0){setAlp(15);drawImgS(Graphs.BAR_EXP,0,0,640,480);setAlp(100)} break;case SCENE_TITLE:battleSwitch=BATTLE_OFF;title();break;case SCENE_IN_NAME:inputName();break;case SCENE_IN_NAME2:inputName2();break;case SCENE_TOWN:battleSwitch=BATTLE_OFF;town();break;case SCENE_SET_PARTY:setParty();break;case SCENE_EQUIPMENT:equipment();break;case SCENE_EQUIPMENT2:equipment2();break;case SCENE_STATES:states();break;case SCENE_SHOP:shop();break;case SCENE_INN:inn();break;case SCENE_INN2:inn2();break;case SCENE_LV_SHOP:lvShop();break;case SCENE_ITEM:useItem();break;case SCENE_DIFFICULTY:selectDifficulty();break;case SCENE_KEYCONFIG:keyConfig();break;case SCENE_WORD_POSITION:wordPosition();break;case SCENE_SELECT_USE_ITEM:selectUseItem();break;case SCENE_SAVE:gameSave();break;case SCENE_GO_TO_DUNGEON:goToDungeon();break;case SCENE_DUNGEON:dungeonMain();break;case SCENE_DUNGEON_MENU:dungeonMenu();break;case SCENE_DUNGEON_ITEM:dungeonUseItem();break;case SCENE_ENCOUNT:battleSwitch=BATTLE_ON;down_timer=0;encountEnemy();break;case SCENE_S_COMMAND:drawBattleBg();drawEnemy();drawBattlePlayers();selectCommand();break;case SCENE_E_DATA:drawBattleBg();drawEnemy();drawBattlePlayers();drawEnemyData();break;case SCENE_TURN_END:drawBattleBg();drawEnemy();enemyPp();drawBattlePlayers();drawEffect();turnEnd();break;case SCENE_ENEMY_ATTACK:drawBattleBg();drawEnemy();drawBattlePlayers();enemyTurn();drawEffect();break;case SCENE_WIN:battleSwitch=BATTLE_OFF;battleWin();down_timer++;if(down_timer===10){playSE(Sounds.SE_DOWN)} break;case SCENE_LOSE:battleSwitch=BATTLE_OFF;battleLose();break;case SCENE_ENDING:ED();break;case SCENE_FREE_BATTLE:freeBattle();break;case SCENE_HELP_BATTLE:helpBattle();break;case SCENE_SELECT_ENEMY:selectEnemy();break}}