コード例 #1
0
ファイル: ranking.py プロジェクト: Ontake44/graslay
    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)
コード例 #2
0
    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
コード例 #3
0
ファイル: ranking.py プロジェクト: Ontake44/graslay
    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()
コード例 #4
0
    def update(self):
        if gcommon.checkUpP():
            self.menuPos -= 1
            if self.menuPos < 0:
                self.menuPos = 4
        if gcommon.checkDownP():
            self.menuPos += 1
            if self.menuPos > 4:
                self.menuPos = 0

        if gcommon.checkRightP():
            if self.menuPos == OPTIONMENU_PLAYER_STOCK:
                gcommon.START_REMAIN += 1
                if gcommon.START_REMAIN > 99:
                    gcommon.START_REMAIN = 99
            elif self.menuPos == OPTIONMENU_BOMB_STOCK:
                gcommon.START_BOM_REMAIN += 1
                if gcommon.START_BOM_REMAIN > 5:
                    gcommon.START_BOM_REMAIN = 5
            elif self.menuPos == OPTIONMENU_START_STAGE:
                gcommon.START_STAGE += 1
                if gcommon.START_STAGE > 3:
                    gcommon.START_STAGE = 3
            elif self.menuPos == OPTIONMENU_SOUND:
                gcommon.SOUND_ON = not gcommon.SOUND_ON
        elif gcommon.checkLeftP():
            if self.menuPos == OPTIONMENU_PLAYER_STOCK:
                gcommon.START_REMAIN -= 1
                if gcommon.START_REMAIN < 1:
                    gcommon.START_REMAIN = 1
            elif self.menuPos == OPTIONMENU_BOMB_STOCK:
                gcommon.START_BOM_REMAIN -= 1
                if gcommon.START_BOM_REMAIN < 0:
                    gcommon.START_BOM_REMAIN = 0
            elif self.menuPos == OPTIONMENU_START_STAGE:
                gcommon.START_STAGE -= 1
                if gcommon.START_STAGE < 1:
                    gcommon.START_STAGE = 1
            elif self.menuPos == OPTIONMENU_SOUND:
                gcommon.SOUND_ON = not gcommon.SOUND_ON

        if gcommon.checkShotKeyP() and self.menuPos == OPTIONMENU_EXIT:
            gcommon.saveSettings()
            gcommon.app.startTitle()
コード例 #5
0
ファイル: graslay.py プロジェクト: Ontake44/graslay
 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
コード例 #6
0
ファイル: title.py プロジェクト: Ontake44/graslay
    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
コード例 #7
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
コード例 #8
0
ファイル: optionMenu.py プロジェクト: Ontake44/graslay
	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()