def update(self): self.bgStarV.update() self.mouseManager.update() if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.markerRects) if n != -1: self.rectIndex = n else: if gcommon.checkLeftP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.rectIndex -= 1 if self.rectIndex < 0: self.rectIndex = self.endIndex elif gcommon.checkRightP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.rectIndex += 1 if self.rectIndex > self.endIndex: self.rectIndex = 0 elif gcommon.checkUpP(): BGM.sound(gcommon.SOUND_MENUMOVE) if self.rectIndex < 7: self.rectIndex = 26 + 10 + self.rectIndex elif self.rectIndex >= 7 and self.rectIndex < 13: self.rectIndex = self.endIndex elif self.rectIndex >= 13 and self.rectIndex < ( 26 + 10): # アルファベット+数字 self.rectIndex -= 13 elif self.rectIndex >= (26 + 10) and self.rectIndex < ( 26 + 10 + 7): # 記号+BS+End self.rectIndex -= 10 elif gcommon.checkDownP(): BGM.sound(gcommon.SOUND_MENUMOVE) if self.rectIndex >= 0 and self.rectIndex < 13: # アルファベット1段目 self.rectIndex += 13 elif self.rectIndex >= 13 and self.rectIndex < ( 13 + 10): # アルファベット2段目の途中 self.rectIndex += 13 elif self.rectIndex >= ( 13 + 10) and self.rectIndex < 26: # アルファベット2段目の途中から2段目最後まで self.rectIndex = 26 + 10 - 1 elif self.rectIndex >= 26 and self.rectIndex < (26 + 7): self.rectIndex += 10 elif self.rectIndex >= (26 + 7) and self.rectIndex < (26 + 10): self.rectIndex = 26 + 10 + 7 - 1 else: self.rectIndex -= 26 + 10 if gcommon.checkShotKeyP(): BGM.sound(gcommon.SOUND_MENUMOVE) if self.cursorPos < 3 and self.rectIndex < self.backSpaceIndex: self.name += self.allChars[self.rectIndex] self.cursorPos += 1 elif self.cursorPos > 0 and self.rectIndex == self.backSpaceIndex: self.name = self.name[:-1] self.cursorPos -= 1 elif self.rectIndex == self.endIndex: self.addRecord() gcommon.app.startScoreRanking(0)
def update(self): self.star_pos -= 0.25 if self.star_pos < 0: self.star_pos += 200 self.mouseManager.update() if gcommon.checkUpP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.menuPos = 0 if gcommon.checkDownP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.menuPos = 1 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.menuRects) if n != -1: self.menuPos = n if self.menuPos == 0: n = -1 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.markerRects) if gcommon.checkLeftP() or (gcommon.checkShotKeyP() and n == 0): if self.gameMode == gcommon.GAMEMODE_NORMAL: if self.difficulty > 0: BGM.sound(gcommon.SOUND_MENUMOVE) self.difficulty -= 1 else: # BOSSRUSH BGM.sound(gcommon.SOUND_MENUMOVE) self.gameMode = gcommon.GAMEMODE_NORMAL self.difficulty = gcommon.DIFFICULTY_HARD elif gcommon.checkRightP() or (gcommon.checkShotKeyP() and n == 1): if self.gameMode == gcommon.GAMEMODE_NORMAL: if self.difficulty < 2: BGM.sound(gcommon.SOUND_MENUMOVE) self.difficulty += 1 else: BGM.sound(gcommon.SOUND_MENUMOVE) self.gameMode = gcommon.GAMEMODE_BOSSRUSH elif self.menuPos == 1: # EXIT if gcommon.checkShotKeyRectP(self.menuRects[1]): BGM.sound(gcommon.SOUND_MENUMOVE) if self.exitTo == 0: gcommon.app.startTitle() else: gcommon.app.startOption()
def doPause(self): if pyxel.btnp(pyxel.KEY_ESCAPE) or pyxel.btnp(pyxel.GAMEPAD_1_START): self.pauseMode = gcommon.PAUSE_NONE pygame.mixer.music.unpause() elif gcommon.checkUpP(): self.pauseMenuPos = (self.pauseMenuPos - 1) % 4 return elif gcommon.checkDownP(): self.pauseMenuPos = (self.pauseMenuPos + 1) % 4 return if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.pauseMenuRects) if n != -1: self.pauseMenuPos = n if self.pauseCnt > 30: if self.pauseMenuPos == 0: # CONTINUE if gcommon.checkShotKeyRectP( self.pauseMenuRects[self.pauseMenuPos]): self.pauseMode = gcommon.PAUSE_NONE pygame.mixer.music.unpause() elif self.pauseMenuPos == 1: # MOUSE OFF/ON n = -1 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.pauseMouseOnOffRects) if gcommon.checkRightP() or (gcommon.checkShotKeyP() and n == 1): Settings.mouseEnabled = True elif gcommon.checkLeftP() or (gcommon.checkShotKeyP() and n == 0): Settings.mouseEnabled = False elif self.pauseMenuPos == 2: if gcommon.checkShotKeyRectP( self.pauseMenuRects[self.pauseMenuPos]): # TITLE gcommon.app.startTitle() elif self.pauseMenuPos == 3: if gcommon.checkShotKeyRectP( self.pauseMenuRects[self.pauseMenuPos]): # EXIT pyxel.quit() self.pauseCnt += 1
def doConfirmContinue(self): if gcommon.checkUpP(): self.pauseMenuPos = (self.pauseMenuPos - 1) % 2 return elif gcommon.checkDownP(): self.pauseMenuPos = (self.pauseMenuPos + 1) % 2 return if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.pauseMenuRects) if n in (0, 1): self.pauseMenuPos = n if self.pauseCnt > 30: if self.pauseMenuPos == 0: # コンティニーする if gcommon.checkShotKeyRectP( self.pauseMenuRects[self.pauseMenuPos]): # YES rankingManager = ranking.RankingManager() # コンティニー時のランキング追加 rankingManager.addContinueRecord() GameSession.execContinue() self.pauseMode = gcommon.PAUSE_NONE ObjMgr.myShip.sub_scene = 3 #pygame.mixer.music.unpause() # # コンティニー時はステージ最初に戻される # # gcommon.app.restartStage() elif self.pauseMenuPos == 1: # ゲームオーバー if gcommon.checkShotKeyRectP( self.pauseMenuRects[self.pauseMenuPos]): # NO gcommon.app.startGameOver() self.pauseCnt += 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
def update(self): self.star_pos -= 0.25 if self.star_pos<0: self.star_pos += 200 self.mouseManager.update() if gcommon.checkUpP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.menuPos -= 1 if self.menuPos < 0: self.menuPos = 4 if gcommon.checkDownP(): BGM.sound(gcommon.SOUND_MENUMOVE) self.menuPos += 1 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 == OPTIONMENU_BGM_VOL: n = -1 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.bgmUpDownRects) if gcommon.checkRightP() or (gcommon.checkShotKeyP() and n == 1): BGM.sound(gcommon.SOUND_MENUMOVE) Settings.bgmVolume += 1 if Settings.bgmVolume > 10: Settings.bgmVolume = 10 elif gcommon.checkLeftP() or (gcommon.checkShotKeyP() and n == 0): BGM.sound(gcommon.SOUND_MENUMOVE) Settings.bgmVolume -= 1 if Settings.bgmVolume < 0: Settings.bgmVolume = 0 elif self.menuPos == OPTIONMENU_SOUND_VOL: n = -1 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.seUpDownRects) if gcommon.checkRightP() or (gcommon.checkShotKeyP() and n == 1): Settings.soundVolume = 10 BGM.sound(gcommon.SOUND_MENUMOVE) elif gcommon.checkLeftP() or (gcommon.checkShotKeyP() and n == 0): Settings.soundVolume = 0 BGM.sound(gcommon.SOUND_MENUMOVE) elif self.menuPos == OPTIONMENU_MOUSE_ENABLED: n = -1 if self.mouseManager.visible: n = gcommon.checkMouseMenuPos(self.mouseOnOffRects) if gcommon.checkRightP() or (gcommon.checkShotKeyP() and n == 1): Settings.mouseEnabled = True BGM.sound(gcommon.SOUND_MENUMOVE) elif gcommon.checkLeftP() or (gcommon.checkShotKeyP() and n == 0): Settings.mouseEnabled = False BGM.sound(gcommon.SOUND_MENUMOVE) elif self.menuPos == OPTIONMENU_SCORE_RANKIG and gcommon.checkShotKeyRectP(self.menuRects[OPTIONMENU_SCORE_RANKIG]): BGM.sound(gcommon.SOUND_MENUMOVE) Settings.saveSettings() gcommon.app.startScoreRanking(1) #gcommon.app.startEnterPlayerNameScene() elif self.menuPos == OPTIONMENU_EXIT and gcommon.checkShotKeyRectP(self.menuRects[OPTIONMENU_EXIT]): BGM.sound(gcommon.SOUND_MENUMOVE) Settings.saveSettings() gcommon.app.startTitle()