def update(self): self.star_pos -= 0.25 if self.star_pos<0: self.star_pos += 256 self.mouseManager.update() if self.state == 0: if self.cnt == 20: BGM.play(BGM.STAGE_SELECT) if self.cnt > 20: if gcommon.checkUpP(): if self.currentStageInfo.parentList != None: lst = self.currentStageInfo.parentList[0].nextStageList if len(lst) > 1: BGM.sound(gcommon.SOUND_MENUMOVE) self.currentIndex -= 1 if self.currentIndex < 0: self.currentIndex = len(lst) -1 self.currentStageInfo = lst[self.currentIndex] elif gcommon.checkDownP(): if self.currentStageInfo.parentList != None: lst = self.currentStageInfo.parentList[0].nextStageList if lst != None and len(lst) > 1: BGM.sound(gcommon.SOUND_MENUMOVE) self.currentIndex += 1 if self.currentIndex >= len(lst): self.currentIndex = 0 self.currentStageInfo = lst[self.currentIndex] elif gcommon.checkRightP(): lst = self.currentStageInfo.nextStageList if lst != None: BGM.sound(gcommon.SOUND_MENUMOVE) if self.currentIndex >= len(lst): self.currentIndex = len(lst) -1 self.currentStageInfo = self.currentStageInfo.nextStageList[self.currentIndex] #gcommon.debugPrint("index = " + str(self.currentIndex) + " " + self.currentStageInfo.stage) elif gcommon.checkLeftP(): if self.currentStageInfo.parentList != None: BGM.sound(gcommon.SOUND_MENUMOVE) self.currentStageInfo = self.currentStageInfo.parentList[0] self.currentIndex = 0 #gcommon.debugPrint("index = " + str(self.currentIndex) + " " + self.currentStageInfo.stage) elif gcommon.checkShotKeyP(): BGM.stop() BGM.sound(gcommon.SOUND_GAMESTART) self.state = 1 self.cnt = 0 else: if self.mouseManager.visible: stageInfo = self.getMouseSelectedStageInfo(self.rootStageInfo) if stageInfo != None: self.currentStageInfo = stageInfo else: #print(str(self.cnt)) if self.cnt > 40: gcommon.app.startNextStage(self.currentStageInfo.stage) self.cnt += 1
def update(self): self.star_pos -= 0.25 if self.star_pos<0: self.star_pos += 256 self.mouseManager.update() if self.state == 0: if self.cnt == 20: BGM.play(BGM.STAGE_SELECT) if self.cnt > 20: if gcommon.checkUpP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.currentIndex -= 1 if self.currentIndex < 0: self.currentIndex = len(self.nextStageList) -1 elif gcommon.checkDownP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.currentIndex += 1 if self.currentIndex >= len(self.nextStageList): self.currentIndex = 0 elif gcommon.checkShotKeyP(): BGM.stop() BGM.sound(gcommon.SOUND_GAMESTART) self.state = 1 self.cnt = 0 else: for i, stageInfo in enumerate(self.nextStageList): rect = gcommon.Rect.createWH(stageInfo.x + StageSelect.nodeBaseX, stageInfo.y + StageSelect.nodeBaseY, 32, 16) if rect.contains(pyxel.mouse_x, pyxel.mouse_y): self.currentIndex = i else: #print(str(self.cnt)) if self.cnt > 40: gcommon.app.startNextStage(self.nextStageList[self.currentIndex].stage) self.currentStageInfo = self.nextStageList[self.currentIndex] self.cnt += 1
def update100(self): self.mouseManager.update() if self.state >= 100 and self.state < 200: if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.menuRects) if n != -1: self.menuPos = n if gcommon.checkUpP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.menuPos = (self.menuPos - 1) % 5 elif gcommon.checkDownP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.menuPos = (self.menuPos + 1) % 5 elif pyxel.btnp(pyxel.KEY_T): gcommon.app.startStageSelect() return if self.menuPos == TITLEMENU_START: n = -1 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.difficultyRects) if gcommon.checkLeftP() or (gcommon.checkShotKeyP() and n == 0): if self.difficulty > 0: BGM.sound(gcommon.SOUND_MENUMOVE) self.difficulty -= 1 return elif gcommon.checkRightP() or (gcommon.checkShotKeyP() and n == 1): if self.difficulty < 2: BGM.sound(gcommon.SOUND_MENUMOVE) self.difficulty += 1 return elif gcommon.checkShotKeyRectP( self.menuRects[TITLEMENU_START]): BGM.stop() BGM.sound(gcommon.SOUND_GAMESTART) # ここですぐにはゲームスタートしない self.state = 200 self.cnt = 0 return elif self.menuPos == TITLEMENU_CUSTOMSTART: if gcommon.checkShotKeyRectP( self.menuRects[TITLEMENU_CUSTOMSTART]): BGM.sound(gcommon.SOUND_MENUMOVE) gcommon.app.startCustomStartMenu() return elif self.menuPos == TITLEMENU_BOSSRUSHSTART: if gcommon.checkShotKeyRectP( self.menuRects[TITLEMENU_BOSSRUSHSTART]): BGM.sound(gcommon.SOUND_MENUMOVE) gcommon.app.startBossRushStartMenu() return elif self.menuPos == TITLEMENU_OPTION: if gcommon.checkShotKeyRectP(self.menuRects[TITLEMENU_OPTION]): BGM.sound(gcommon.SOUND_MENUMOVE) gcommon.app.startOption() return elif self.menuPos == TITLEMENU_EXIT: if gcommon.checkShotKeyRectP(self.menuRects[TITLEMENU_EXIT]): pyxel.quit() if self.state == 102: # 明るくなる if self.subCnt > 3: self.subState += 1 self.subCnt = 0 if self.subState == len(TitleScene.colorTable3): self.subState = len(TitleScene.colorTable3) - 1 self.state = 103 self.subCnt += 1 elif self.state == 103: # 戻る if self.subCnt > 3: self.subState -= 1 self.subCnt = 0 if self.subState == 0: self.state = 104 self.cnt = 0 return self.subCnt += 1 elif self.state == 104: if self.subCnt > 32: self.state = 100 self.cnt = 0 return self.subCnt += 1 elif self.state == 200: # GAME START if self.cnt > 40: gcommon.app.startNormalGame(self.difficulty) self.cnt += 1 if self.cnt >= 5 * 60: self.cnt = 0 if self.state == 100: self.state = 102 self.subState = 0 self.subCnt = 0
def update(self): self.star_pos -= 0.25 if self.star_pos<0: self.star_pos += 200 self.mouseManager.update() if self.cnt >= 6*60: self.cnt = 0 if self.state == 0: if gcommon.checkUpP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.menuPos -= 1 if self.menuPos == MENU_WEAPON_OPTION and Settings.weaponType == gcommon.WeaponType.TYPE_A: self.menuPos = MENU_WEAPON_TYPE if self.menuPos < 0: self.menuPos = 4 if gcommon.checkDownP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.menuPos += 1 if self.menuPos == MENU_WEAPON_OPTION and Settings.weaponType == gcommon.WeaponType.TYPE_A: self.menuPos = MENU_GAME_START if self.menuPos > 4: self.menuPos = 0 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.menuRects) if n != -1: self.menuPos = n if self.menuPos == MENU_PLAYER_STOCK: n = -1 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.playerStockRects) if gcommon.checkRightP() or (gcommon.checkShotKeyP() and n == 1): BGM.sound(gcommon.SOUND_MENUMOVE) Settings.playerStock += 1 if Settings.playerStock > 99: Settings.playerStock = 99 elif gcommon.checkLeftP() or (gcommon.checkShotKeyP() and n == 0): BGM.sound(gcommon.SOUND_MENUMOVE) Settings.playerStock -= 1 if Settings.playerStock < 1: Settings.playerStock = 1 elif self.menuPos == MENU_WEAPON_TYPE: n = -1 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.weaponTypeRects) if gcommon.checkRightP() or (gcommon.checkShotKeyP() and n == 1): BGM.sound(gcommon.SOUND_MENUMOVE) Settings.weaponType = gcommon.WeaponType.TYPE_B elif gcommon.checkLeftP() or (gcommon.checkShotKeyP() and n == 0): BGM.sound(gcommon.SOUND_MENUMOVE) Settings.weaponType = gcommon.WeaponType.TYPE_A elif self.menuPos == MENU_WEAPON_OPTION: n = -1 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.multipleRects) if gcommon.checkRightP() or (gcommon.checkShotKeyP() and n == 1): BGM.sound(gcommon.SOUND_MENUMOVE) Settings.multipleCount += 1 if Settings.multipleCount > 20: Settings.multipleCount = 20 elif gcommon.checkLeftP() or (gcommon.checkShotKeyP() and n == 0): BGM.sound(gcommon.SOUND_MENUMOVE) Settings.multipleCount -= 1 if Settings.multipleCount < 0: Settings.multipleCount = 0 elif self.menuPos == MENU_GAME_START: n = -1 if gcommon.checkShotKeyP(): BGM.stop() BGM.sound(gcommon.SOUND_GAMESTART) Settings.saveSettings() self.state = 1 self.cnt = 0 elif self.menuPos == MENU_EXIT: if gcommon.checkShotKeyRectP(self.menuRects[MENU_EXIT]): Settings.saveSettings() BGM.sound(gcommon.SOUND_MENUMOVE) gcommon.app.startTitle() else: # GAME START if self.cnt > 40: gcommon.app.startBossRushGame() self.cnt += 1