コード例 #1
0
    def updateMode2(self):
        if self.state == 0:
            if self.cnt > 120:
                self.nextState()
        elif self.state == 1:
            # 右の画面外に移動
            if self.cnt == 1:
                obj = enemy.Splash.appendDr(self.coreX, self.coreY -8, gcommon.C_LAYER_SKY, math.pi, math.pi/6, 20)
                obj.ground = True
                obj = enemy.Splash.appendDr(self.coreX -16, self.coreY, gcommon.C_LAYER_SKY, math.pi, math.pi/6, 20)
                obj.ground = True
                obj = enemy.Splash.appendDr(self.coreX, self.coreY +8, gcommon.C_LAYER_SKY, math.pi, math.pi/6, 20)
                obj.ground = True
            if self.coreX < 300:
                self.coreX += 4
            if self.cnt == 120:
                gcommon.scroll_flag = True
                # ボスコアを生成
                ObjMgr.addObj(BossLast1Core(self.coreX, self.coreY, self.isBossRush))
                if self.isBossRush == False:
                    ObjMgr.addObj(enemy.Delay(BossLastBaseExplosion, [], 240))
                    BGM.play(BGM.BOSS_LAST)
        if self.x <= -160:
            self.remove()

        self.rad = (self.rad + math.pi/30) % (math.pi * 2)
コード例 #2
0
	def update(self):
		if self.cnt % 3 == 0:
			obj = ObjMgr.addObj(enemy.Explosion(32 +random.randrange(64), random.randrange(gcommon.SCREEN_MAX_Y), gcommon.C_LAYER_GRD, gcommon.C_EXPTYPE_SKY_M))
			obj.particle = False
			if self.cnt < 120:
				# 120超えるとサウンドなし
				BGM.sound(gcommon.SOUND_MID_EXP)
コード例 #3
0
 def broken(self):
     for feeler in self.feelers:
         feeler.remove()
     for feelerShot in self.feelerShots:
         feelerShot.remove()
     for cell in self.bossCells:
         if cell.removeFlag == False:
             cell.remove()
     self.remove()
     enemy.removeEnemyShot()
     ObjMgr.objs.append(
         boss.BossExplosion(gcommon.getCenterX(self),
                            gcommon.getCenterY(self),
                            gcommon.C_LAYER_EXP_SKY))
     GameSession.addScore(self.score)
     BGM.sound(gcommon.SOUND_LARGE_EXP)
     enemy.Splash.append(gcommon.getCenterX(self), gcommon.getCenterY(self),
                         gcommon.C_LAYER_EXP_SKY)
     if self.isBossRush:
         gcommon.debugPrint("Boss2 call NextEvent")
         if self.timerObj != None:
             self.timerObj.stop()
             self.timerObj = None
         ObjMgr.objs.append(enemy.NextEvent([0, None, 240]))
     else:
         ObjMgr.objs.append(enemy.Delay(enemy.StageClear, None, 240))
コード例 #4
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)
コード例 #5
0
 def update(self):
     if self.state == 0:
         if self.cnt == 0:
             BGM.sound(gcommon.SOUND_BOSS_EXP)
         elif self.cnt > 120:
             #self.nextState()
             self.remove()
     elif self.state == 1:
         if self.cnt > 40:
             self.remove()
コード例 #6
0
ファイル: bossCave.py プロジェクト: Ontake44/graslay
 def broken(self):
     gcommon.breakObjects(self.bat1List)
     gcommon.breakObjects(self.worm4List)
     self.setState(100)
     self.shotHitCheck = False
     self.hitCheck = False
     enemy.removeEnemyShot()
     GameSession.addScore(self.score)
     BGM.sound(gcommon.SOUND_LARGE_EXP)
     enemy.Splash.append(self.x + 59, self.y + 64, gcommon.C_LAYER_EXP_SKY)
     ObjMgr.objs.append(enemy.Delay(enemy.StageClear, None, 200))
コード例 #7
0
ファイル: ending.py プロジェクト: Ontake44/graslay
 def __init__(self, parent):
     self.parent = parent
     self.py = 190
     self.px = 150
     self.dy = -2
     self.sx = 88
     self.sy = 32
     self.size = 1.0
     self.state = 0
     self.cnt = 0
     self.message = "THE END"
     self.objs = []
     BGM.playOnce(BGM.ENDING)
コード例 #8
0
ファイル: gameSession.py プロジェクト: Ontake44/graslay
 def addScore(cls, score):
     __class__.score += score
     __class__.scoreCheck += score
     if __class__.scoreFirstExtend == False and __class__.scoreCheck >= 20000:
         __class__.playerStock += 1
         __class__.scoreFirstExtend = True
         BGM.sound(gcommon.SOUND_EXTENDED, gcommon.SOUND_CH1)
         gcommon.debugPrint("First Extended")
     elif __class__.scoreCheck >= 50000:
         __class__.playerStock += 1
         __class__.scoreCheck = 0
         BGM.sound(gcommon.SOUND_EXTENDED, gcommon.SOUND_CH1)
         gcommon.debugPrint("Extended by 50000")
コード例 #9
0
 def broken(self):
     self.remove()
     enemy.removeEnemyShot()
     ObjMgr.objs.append(boss.BossExplosion(gcommon.getCenterX(self), gcommon.getCenterY(self), gcommon.C_LAYER_EXP_SKY))
     GameSession.addScore(self.score)
     BGM.sound(gcommon.SOUND_LARGE_EXP)
     enemy.Splash.append(gcommon.getCenterX(self), gcommon.getCenterY(self), gcommon.C_LAYER_EXP_SKY)
     if self.isBossRush:
         if self.timerObj != None:
             self.timerObj.stop()
             self.timerObj = None
         ObjMgr.objs.append(enemy.NextEvent([0, None, 120]))
     else:
         ObjMgr.objs.append(enemy.Delay(enemy.StageClear, None, 240))
コード例 #10
0
 def checkMyShipCollision(self):
     if gcommon.check_collision(self, ObjMgr.myShip):
         self.hitCheck = False
         if self.state == 0:
             # しばらくすると当たり判定
             self.setState(1)
         else:
             self.setState(3)
             BGM.sound(gcommon.SOUND_ITEM_GET, gcommon.SOUND_CH2)
             if self.hide:
                 GameSession.addScore(1000)
             else:
                 GameSession.addScore(500)
     return False
コード例 #11
0
 def broken(self):
     self.mode = 2
     self.setState(0)
     self.hitCheck = False
     self.shotHitCheck = False
     self.removeAllShot()
     enemy.removeEnemyShot()
     BGM.sound(gcommon.SOUND_LARGE_EXP)
     enemy.Splash.append(gcommon.getCenterX(self), gcommon.getCenterY(self), gcommon.C_LAYER_EXP_SKY)
     GameSession.addScore(self.score)
     if self.isBossRush:
         if self.timerObj != None:
             self.timerObj.stop()
             self.timerObj = None
コード例 #12
0
ファイル: myShip.py プロジェクト: Ontake44/graslay
 def doShot(self, shotGroups, x, y, n):
     if len(shotGroups) < self.shotMax:
         shotGroup = MyShotGroup(shotGroups)
         #shotGroup.shotGroups = shotGroups
         if self.weapon == 0:
             # Double
             self.shotMax = 2
             #self.appendShot(shotGroup, self.createShot(x+12, y +4, 8, 0, 0))
             self.appendShot(shotGroup, MyShotBDouble(x + 14, y + 7.5, 0))
             self.appendShot(shotGroup, MyShotBDouble(x + 10, y + 4, 1))
             if n == -1:
                 BGM.sound(gcommon.SOUND_SHOT)
         elif self.weapon == 1:
             self.shotMax = 2
             self.appendShot(shotGroup, MyShotBDouble(x + 14, y + 7.5, 0))
             self.appendShot(shotGroup, MyShotBDouble(x, y + 7.5, 2))
             if n == -1:
                 BGM.sound(gcommon.SOUND_SHOT)
         elif self.weapon == 2:
             self.shotMax = 1
             self.appendShot(shotGroup,
                             MyShotBLaser(self.posList, self.posLate, n))
             if n == -1:
                 BGM.sound(gcommon.SOUND_SHOT)
         else:
             self.shotMax = 2
             self.appendShot(shotGroup, MyShotBRipple(x + 16, y + 7))
             if n == -1:
                 BGM.sound(gcommon.SOUND_SHOT)
         shotGroups.append(shotGroup)
コード例 #13
0
 def shotMain(self):
     r = self.gunRad + math.pi
     px = self.gun_cx + math.cos(r + math.pi/20) * 30
     py = self.gun_cy + math.sin(r + math.pi/20) * 30
     enemy.enemy_shot_rad(px, py, 4.5, 1, r)
     px = self.gun_cx + math.cos(r + math.pi/20) * 25
     py = self.gun_cy + math.sin(r + math.pi/20) * 25
     enemyOthers.Spark1.create2(px, py, gcommon.C_LAYER_E_SHOT)
     px = self.gun_cx + math.cos(r - math.pi/20) * 30
     py = self.gun_cy + math.sin(r - math.pi/20) * 30
     enemy.enemy_shot_rad(px, py, 4.5, 1, r)
     px = self.gun_cx + math.cos(r - math.pi/20) * 25
     py = self.gun_cy + math.sin(r - math.pi/20) * 25
     enemyOthers.Spark1.create2(px, py, gcommon.C_LAYER_E_SHOT)
     BGM.sound(gcommon.SOUND_SHOT2)
コード例 #14
0
ファイル: boss4.py プロジェクト: Ontake44/graslay
    def shotDanmaku(self):
        if self.cnt & 31 == 31:
            speed = 2.5
            enemy.enemy_shot_dr(self.x + 52, self.y + 16, speed, 0, 35)
            enemy.enemy_shot_dr(self.x + 48, self.y + 22, speed, 0, 31)
            enemy.enemy_shot_dr(self.x + 48, self.y + 42, speed, 0, 33)
            enemy.enemy_shot_dr(self.x + 52, self.y + 48, speed, 0, 27)

            if GameSession.isHard():
                enemy.enemy_shot_dr(self.x + 52, self.y + 16, speed, 0, 37)
                enemy.enemy_shot_dr(self.x + 52, self.y + 48, speed, 0, 29)
        else:
            speed = 1.5
            enemy.enemy_shot_dr(self.x + 52, self.y + 16, speed, 1, 36)
            enemy.enemy_shot_dr(self.x + 52, self.y + 48, speed, 1, 28)
            if GameSession.isHard():
                enemy.enemy_shot_dr(self.x + 48, self.y + 22, speed, 1, 34)
                enemy.enemy_shot_dr(self.x + 48, self.y + 42, speed, 1, 30)
        BGM.sound(gcommon.SOUND_SHOT2)
コード例 #15
0
 def shotFix4(self):
     ox = 0 if self.isLeft else 8
     if self.shotFlag:
         enemy.enemy_shot_dr(self.x + 48 + ox * 2, self.y + 22, 4, 1,
                             self.getDirection(32 + 3))
         enemy.enemy_shot_dr(self.x + 52 + ox, self.y + 16, 4, 1,
                             self.getDirection(32 + 7))
         enemy.enemy_shot_dr(self.x + 48 + ox * 2, self.y + 42, 4, 1,
                             self.getDirection(32 - 3))
         enemy.enemy_shot_dr(self.x + 52 + ox, self.y + 48, 4, 1,
                             self.getDirection(32 - 7))
         self.shotFlag = False
     else:
         enemy.enemy_shot_dr(self.x + 48 + ox * 2, self.y + 22, 4, 1,
                             self.getDirection(32 + 1))
         enemy.enemy_shot_dr(self.x + 52 + ox, self.y + 16, 4, 1,
                             self.getDirection(32 + 5))
         enemy.enemy_shot_dr(self.x + 48 + ox * 2, self.y + 42, 4, 1,
                             self.getDirection(32 - 1))
         enemy.enemy_shot_dr(self.x + 52 + ox, self.y + 48, 4, 1,
                             self.getDirection(32 - 5))
         self.shotFlag = True
     BGM.sound(gcommon.SOUND_SHOT2)
コード例 #16
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():
                    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
コード例 #17
0
ファイル: myShip.py プロジェクト: Ontake44/graslay
 def doEffect(self, effectSound):
     # 跳弾表示
     ObjMgr.addObj(enemy.Particle1(self.x + self.right, self.y, 0.0, 4, 50))
     if effectSound:
         BGM.sound(gcommon.SOUND_HIT, gcommon.SOUND_CH2)
コード例 #18
0
ファイル: myShip.py プロジェクト: Ontake44/graslay
 def doEffect(self, effectSound):
     # 跳弾表示
     enemy.Particle1.appendShotCenter(self)
     if effectSound:
         BGM.sound(gcommon.SOUND_HIT, gcommon.SOUND_CH2)
コード例 #19
0
ファイル: myShip.py プロジェクト: Ontake44/graslay
    def update(self):
        if gcommon.sync_map_y != 0:
            gcommon.cur_map_dy = 0
        self.afterBurner = False
        if self.sub_scene == 1:
            # ゲーム中
            self.actionButtonInput()
        elif self.sub_scene == 2:
            # 爆発中
            if self.cnt > 90:
                # 爆発中を終了
                if GameSession.playerStock == 0:
                    #self.sub_scene = 10
                    self.setSubScene(10)
                    self.cnt = 0
                    self.sprite = 1
                    self.x = -16
                    self.parent.OnPlayerStockOver()
                else:
                    GameSession.playerStock -= 1
                    #--restart_game()
                    #self.sub_scene=3
                    self.setSubScene(3)
                    self.cnt = 0
                    self.sprite = 1
                    self.x = -16
        elif self.sub_scene == 3:
            # 復活中
            self.dx = 0
            self.x += 1
            if self.x >= gcommon.MYSHIP_START_X:
                self.cnt = 0
                #self.sub_scene = 4
                self.setSubScene(4)
        elif self.sub_scene == 4:
            # 無敵中
            self.actionButtonInput()
            if self.cnt == 120:
                self.cnt = 0
                self.sub_scene = 1
        elif self.sub_scene == 5:  # scene == 5
            self.afterBurner = True
            # クリア時
            if self.cnt == 0:
                BGM.sound(gcommon.SOUND_AFTER_BURNER)
            if self.x < 256 + 32:
                if self.dx < 8:
                    self.dx += 0.25
                self.x += self.dx
        elif self.sub_scene == 6:
            pass
        else:  # sub_scene = 10
            # continue確認中
            pass

        # 水しぶき
        if self.cnt % 10 == 0:
            if self.y + gcommon.map_y + 12 > gcommon.waterSurface_y and self.y + gcommon.map_y + 8 <= gcommon.waterSurface_y:
                enemy.Splash.appendDr3(self.x + 16, self.y + 8,
                                       gcommon.C_LAYER_GRD,
                                       math.pi + math.pi / 16, math.pi / 8,
                                       6.0, 20, 50, 10)
            elif self.y + gcommon.map_y + 8 > gcommon.waterSurface_y:
                enemy.Splash.appendDr3(self.x, self.y + 8, gcommon.C_LAYER_GRD,
                                       math.pi, math.pi / 12, 2.0, 10, 20, 10)

        self.cnt += 1
コード例 #20
0
ファイル: myShip.py プロジェクト: Ontake44/graslay
    def shot(self):
        if len(ObjMgr.shotGroups) < self.shotMax:
            shotGroup = MyShotGroup(ObjMgr.shotGroups)
            if self.weapon == 0:
                self.shotMax = 6
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x + 12, self.y + 4, 8, 0, 0)))
            elif self.weapon == 1:
                self.shotMax = 5
                dx = 8 * math.cos(math.pi - math.pi / 64 * self.roundAngle)
                dy = 8 * math.sin(math.pi - math.pi / 64 * self.roundAngle)
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x + 6, self.y + 4, dx, dy, 1)))
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x + 6, self.y + 4, dx, -dy, 1)))
            else:
                self.shotMax = 2
                # 前
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x + 12, self.y + 4, 6, 0, 2)))

                # やや斜め前
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x + 12, self.y + 4, 5.5, 2.3,
                                        -3)))
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x + 12, self.y + 4, 5.5, -2.3,
                                        3)))

                # 斜め前
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x + 12, self.y + 4, 4.2, 4.2,
                                        -4)))
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x + 12, self.y + 4, 4.2, -4.2,
                                        4)))

                # 斜め後
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x - 2, self.y + 4, -4.2, 4.2, 4)))
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x - 2, self.y + 4, -4.2, -4.2,
                                        -4)))

                # 後ろ
                ObjMgr.shots.append(
                    shotGroup.append(
                        self.createShot(self.x - 2, self.y + 4, -6, 0, 2)))

            BGM.sound(gcommon.SOUND_SHOT)
            ObjMgr.shotGroups.append(shotGroup)
コード例 #21
0
ファイル: title.py プロジェクト: Ontake44/graslay
 def init(self):
     BGM.play(BGM.TITLE)
コード例 #22
0
ファイル: stage.py プロジェクト: Ontake44/graslay
    def initStage(cls, stage, restart):
        gcommon.breakableMapData = False
        pyxel.tilemap(0).refimg = 1
        gcommon.waterSurface_y = 256 * 8.0
        gcommon.scrollController = None
        # タイルマップクリア
        __class__.clearTilemap()

        if stage == "1A":
            #pyxel.load("assets/graslay_vehicle01.pyxres", False, False, True, True)
            pyxel.image(1).load(0, 0, "assets/graslay1.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = False
            gcommon.draw_star = True
            gcommon.eshot_sync_scroll = False
            MapData.loadMapData(0, "assets/graslay1.pyxmap")
            MapData.loadMapData(1, "assets/graslay1b.pyxmap")
            MapData.loadMapAttribute("assets/graslay1.mapatr")
            pyxel.tilemap(1).refimg = 1
            if restart or GameSession.gameMode == gcommon.GAMEMODE_CUSTOM:
                # 初期スタートは発艦時にBGM開始されているので、BGM流すのはリスタート・カスタム時だけ
                BGM.play(BGM.STAGE1)
        elif stage == "2A":
            # 生物
            #pyxel.load("assets/graslay_dangeon22.pyxres", False, False, True, True)
            pyxel.image(1).load(0, 0, "assets/graslay2.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = False
            gcommon.draw_star = False
            gcommon.eshot_sync_scroll = False
            MapData.loadMapData(0, "assets/graslay2.pyxmap")
            MapData.loadMapAttribute("assets/graslay2.mapatr")
        elif stage == "2B":
            # 洞窟
            pyxel.image(1).load(0, 0, "assets/stage_cave.png")
            pyxel.image(2).load(0, 0, "assets/stage_cave-2.png")
            gcommon.sync_map_y = 2
            gcommon.long_map = True
            gcommon.draw_star = False
            gcommon.eshot_sync_scroll = True
            MapData.loadMapData(0, "assets/stage_cave.pyxmap")
            MapData.loadMapData(1, "assets/stage_caveb.pyxmap")
            MapData.loadMapAttribute("assets/stage_cave.mapatr")
            pyxel.tilemap(1).refimg = 1
        elif stage == "3B":
            # 倉庫
            pyxel.image(1).load(0, 0, "assets/stage_warehouse.png")
            pyxel.image(2).load(0, 0, "assets/stage_warehouse-2.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = True
            gcommon.draw_star = False
            gcommon.eshot_sync_scroll = False
            MapData.loadMapData(0,
                                "assets/stage_warehouse0.pyxmap")  # 手前に見えるマップ
            MapData.loadMapData(2,
                                "assets/stage_warehouse1.pyxmap")  # 奥に見えるマップ
            MapData.loadMapData(5,
                                "assets/stage_warehousei.pyxmap")  # アイテム用マップ
            MapData.loadMapData(7, "assets/stage_warehouseb.pyxmap")  # 遠景
            pyxel.tilemap(0).refimg = 1
            pyxel.tilemap(2).refimg = 1
            pyxel.tilemap(7).refimg = 1  # background
            MapData.loadMapAttribute("assets/stage_warehouse.mapatr")
        elif stage == "3A":
            # 高速スクロール
            pyxel.image(1).load(0, 0, "assets/graslay3.png")
            gcommon.sync_map_y = 1
            gcommon.long_map = True
            gcommon.draw_star = True
            gcommon.eshot_sync_scroll = False
            gcommon.breakableMapData = True
            MapData.loadMapData(0, "assets/graslay3-0.pyxmap")
            MapData.loadMapData(1, "assets/graslay3-1.pyxmap")
            MapData.loadMapData(2, "assets/graslay3b.pyxmap")
            MapData.loadMapAttribute("assets/graslay3.mapatr")
            pyxel.tilemap(1).refimg = 1
            pyxel.tilemap(2).refimg = 1
        elif stage == "3C":
            # 巨大戦艦
            pyxel.image(1).load(0, 0, "assets/stage_battleship.png")
            pyxel.image(2).load(0, 0, "assets/stage_battleship-2.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = True
            gcommon.draw_star = True
            gcommon.eshot_sync_scroll = False
            MapData.loadMapData(0, "assets/stage_battleship.pyxmap")
            MapData.loadMapData(1, "assets/stage_battleship-2.pyxmap")
            MapData.loadMapAttribute("assets/stage_battleship.mapatr")
            MapData.loadMapAttribute2("assets/stage_battleship-2.mapatr")
            pyxel.tilemap(0).refimg = 1
            pyxel.tilemap(1).refimg = 2
        elif stage == "4A":
            # 遺跡
            pyxel.image(1).load(0, 0, "assets/graslay4.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = False
            gcommon.draw_star = True
            gcommon.eshot_sync_scroll = False
            MapData.loadMapData(0, "assets/graslay4.pyxmap")
            MapData.loadMapData(1, "assets/graslay4b.pyxmap")
            MapData.loadMapAttribute("assets/graslay4.mapatr")
            pyxel.tilemap(1).refimg = 1
        elif stage == "4B":
            # 迷宮
            pyxel.image(1).load(0, 0, "assets/stage_labyrinth.png")
            pyxel.image(2).load(0, 0, "assets/stage_labyrinth2.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = True
            gcommon.draw_star = True
            gcommon.eshot_sync_scroll = False
            MapData.loadMapData(0, "assets/stage_labyrinth.pyxmap")
            MapData.loadMapData(1, "assets/stage_labyrinth2.pyxmap")
            MapData.loadMapData(7, "assets/stage_labyrinthb.pyxmap")
            MapData.loadMapAttribute("assets/stage_labyrinth.mapatr")
            pyxel.tilemap(1).refimg = 1
            pyxel.tilemap(7).refimg = 1
        elif stage == "5A":
            # ファクトリー
            pyxel.image(1).load(0, 0, "assets/graslay_factory.png")
            pyxel.image(2).load(0, 0, "assets/graslay_factory-2.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = True
            gcommon.draw_star = True
            gcommon.eshot_sync_scroll = False
            MapData.loadMapData(0, "assets/graslay_factory.pyxmap")
            MapData.loadMapData(1, "assets/graslay_factoryb.pyxmap")
            MapData.loadMapAttribute("assets/graslay_factory.mapatr")
            pyxel.tilemap(1).refimg = 1
        elif stage == "5B":
            # 火
            pyxel.image(1).load(0, 0, "assets/stage_fire.png")
            pyxel.image(2).load(0, 0, "assets/stage_fire2.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = True
            gcommon.draw_star = True
            gcommon.eshot_sync_scroll = False
            MapData.loadMapData(0, "assets/stage_fire0.pyxmap")  # 基地
            MapData.loadMapData(2, "assets/stage_fire1.pyxmap")  # 火
            MapData.loadMapData(7, "assets/stage_fireb.pyxmap")  # 遠景?
            MapData.loadMapAttribute("assets/stage_fire.mapatr")
            pyxel.tilemap(0).refimg = 1
            pyxel.tilemap(2).refimg = 1
        elif stage == "6A":
            # 最終ステージA
            pyxel.image(1).load(0, 0, "assets/graslay_last.png")
            pyxel.image(2).load(0, 0, "assets/graslay_last-1.png")
            #pyxel.image(2).load(0,0,"assets/graslay_last-2.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = True
            gcommon.draw_star = True
            gcommon.eshot_sync_scroll = False
            MapData.loadMapData(0, "assets/graslay_last.pyxmap")
            MapData.loadMapData(1, "assets/graslay_lastb.pyxmap")
            MapData.loadMapAttribute("assets/graslay_last.mapatr")
            pyxel.tilemap(1).refimg = 1
        elif stage == "6B":
            # 最終ステージB
            pyxel.image(1).load(0, 0, "assets/stage_enemybase.png")
            pyxel.image(2).load(0, 0, "assets/stage_enemybase-2.png")
            #pyxel.image(2).load(0,0,"assets/graslay_last-2.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = True
            gcommon.draw_star = True
            gcommon.eshot_sync_scroll = False
            gcommon.breakableMapData = True
            gcommon.scrollController = ScrollController1(
                __class__.scrollTable6B)
            MapData.loadMapData(0, "assets/stage_enemybase.pyxmap")
            MapData.loadMapData(1, "assets/stage_enemybase-2.pyxmap")
            MapData.loadMapData(2, "assets/stage_enemybase-3.pyxmap")
            MapData.loadMapData(7, "assets/stage_enemybaseb.pyxmap")
            MapData.loadMapAttribute("assets/stage_enemybase.mapatr")
            pyxel.tilemap(1).refimg = 1
            pyxel.tilemap(2).refimg = 1
            pyxel.tilemap(4).refimg = 1
            pyxel.tilemap(7).refimg = 1
        elif stage == "B1":
            #pyxel.load("assets/graslay_vehicle01.pyxres", False, False, True, True)
            #pyxel.image(1).load(0,0,"assets/banana1.png")
            gcommon.sync_map_y = 0
            gcommon.long_map = False
            gcommon.draw_star = True
            gcommon.eshot_sync_scroll = False
            MapData.loadMapData(0, "assets/graslay1.pyxmap")
            MapData.loadMapData(1, "assets/graslay1b.pyxmap")
            MapData.loadMapAttribute("assets/graslay1.mapatr")
            pyxel.tilemap(1).refimg = 1
        #elif self.stage == 3:
        #	pyxel.image(1).load(0,0,"assets\gra-den3a.png")
        #	pyxel.image(2).load(0,0,"assets\gra-den3b.png")
        #	gcommon.draw_star = True


# bossRushScrollConteroller3A = [
#         [0, ScrollController1.LOOP_X, 64*8, 96*8],     # 0
#         [0, ScrollController1.SET_SCROLL, 2.0, 0.0],     # 1
# ]

# class InitStage3A(EnemyBase):
#     def __init__(self, t):
#         super(__class__, self).__init__()
#         pyxel.image(1).load(0,0,"assets/graslay3.png")
#         gcommon.sync_map_y = 0
#         gcommon.long_map = False
#         gcommon.draw_star = True
#         gcommon.eshot_sync_scroll = False
#         gcommon.breakableMapData = False
#         MapData.loadMapData(0, "assets/graslay3rush.pyxmap")
#         MapData.loadMapData(2, "assets/graslay3b.pyxmap")
#         MapData.loadMapAttribute("assets/graslay3.mapatr")
#         pyxel.tilemap(2).refimg = 1
#         gcommon.scrollController = ScrollController1(bossRushScrollConteroller3A)
#         ObjMgr.setDrawMap(MapDraw3rush())

#     def update(self):
#         gcommon.eventManager.nextEvent()
#         self.remove()

# class EndStage3A(EnemyBase):
#     def __init__(self, t):
#         super(__class__, self).__init__()
#         gcommon.scrollController = None
#         ObjMgr.setDrawMap(None)
#         gcommon.cur_scroll_x = 0.5
#         gcommon.cur_scroll_y = 0.0

#     def update(self):
#         gcommon.eventManager.nextEvent()
#         self.remove()

# class InitStage3B(EnemyBase):
#     def __init__(self, t):
#         super(__class__, self).__init__()
#         pyxel.image(1).load(0,0,"assets/stage_warehouse.png")
#         pyxel.image(2).load(0,0,"assets/stage_warehouse-2.png")
#         self.layer = gcommon.C_LAYER_UNDER_GRD
#         gcommon.sync_map_y = 0
#         gcommon.long_map = False
#         gcommon.draw_star = True
#         gcommon.eshot_sync_scroll = False
#         gcommon.breakableMapData = False
#         MapData.loadMapData(0, "assets/stage_warehouse-rush.pyxmap")    # 手前に見えるマップ
#         pyxel.tilemap(0).refimg = 1
#         ObjMgr.setDrawMap(None)
#         gcommon.cur_scroll_x = 0.0
#         gcommon.cur_scroll_y = 0.0
#         gcommon.map_x = 0
#         gcommon.map_y = 0
#         gcommon.debugPrint("InitStage3B")

#     def update(self):
#         if self.cnt < 90:
#             pass
#         else:
#             gcommon.eventManager.nextEvent()
#             self.remove()

#     def draw(self):
#         if self.state == 0:
#             x = math.pow(1 - (self.cnt/90.0), 3)
#             pyxel.bltm(x * 256, 4, 0, 40, 0, 32, 24, 3)
コード例 #23
0
ファイル: gameSession.py プロジェクト: Ontake44/graslay
 def addPlayerStock(cls):
     __class__.playerStock += 1
     BGM.sound(gcommon.SOUND_EXTENDED, gcommon.SOUND_CH1)
コード例 #24
0
    def update(self):
        if self.state == 0:
            self.x -= 1
            if self.x <= 256 - 88:
                self.nextState()
            self.body.x = self.x + 20
            self.anchor.x = self.body.x - 8
            self.anchor.y = self.body.y + 16
        elif self.state == 1:
            if self.cnt > 30:
                self.nextState()
        elif self.state == 2:
            if self.mode == 0:
                # 上に移動
                self.body.y -= 2
                if self.body.y < self.body_min_y:
                    self.body.y = self.body_min_y
                    self.setMode(1)
            elif self.mode == 1:
                # 下に移動
                self.body.y += 2
                if self.body.y > self.body_max_y:
                    self.body.y = self.body_max_y
                    self.nextState()
            self.setBodyAnchorPos()
        elif self.state == 3:
            # 下端からショットを打ちながら上端まで移動
            self.body.y -= 1
            if self.body.y < self.body_min_y:
                self.body.y = self.body_min_y
                self.nextState()
            elif self.cnt % self.mainShotCycle == 0:
                ObjMgr.addObj(Boss3Shot(self.x, self.body.y + 12, 4))
                ObjMgr.addObj(Boss3Shot(self.x, self.body.y + 37, 4))
                enemyOthers.Spark1.create(self.body, 2, 12,
                                          gcommon.C_LAYER_E_SHOT)
                enemyOthers.Spark1.create(self.body, 2, 37,
                                          gcommon.C_LAYER_E_SHOT)
                BGM.sound(gcommon.SOUND_SHOT3)
            self.setBodyAnchorPos()
        elif self.state == 4:
            cy = gcommon.getCenterY(ObjMgr.myShip)
            if cy > self.body.y + 25:
                self.body.y += 1
                if self.body.y > self.body_max_y:
                    self.body.y = self.body_max_y
            elif cy < self.body.y + 23:
                self.body.y -= 1
                if self.body.y < self.body_min_y:
                    self.body.y = self.body_min_y

            self.setBodyAnchorPos()
            if self.cnt % self.shotCycle == 0:
                enemy.enemy_shot_multi(self.x + 20, self.y + 27, 2, 0, 5, 5)
                enemyOthers.Spark1.create2(self.x + 20, self.y + 27,
                                           gcommon.C_LAYER_E_SHOT)
                enemy.enemy_shot_multi(self.x + 20, self.y + 176 - 27, 2, 0, 5,
                                       5)
                enemyOthers.Spark1.create2(self.x + 20, self.y + 176 - 27,
                                           gcommon.C_LAYER_E_SHOT)
                BGM.sound(gcommon.SOUND_SHOT2)
            if self.cnt > 180:
                self.nextState()
        elif self.state == 5:
            if self.mode == 0:
                # アンカーが伸びる
                if self.modeCnt == 0:
                    BGM.sound(gcommon.SOUND_BOSS3_ANCHOR)
                self.anchor.x -= 8
                if self.anchor.x <= 0:
                    self.anchor.x = 0
                    self.nextMode()
            elif self.mode == 1:
                # アンカーが伸びきった
                if self.modeCnt > 30:
                    self.nextMode()
                else:
                    self.modeCnt += 1
            elif self.mode == 2:
                # アンカーが縮む
                self.anchor.x += 4
                if self.anchor.x >= self.body.x - 8:
                    self.anchor.x = self.body.x - 8
                    self.nextMode()
            elif self.mode == 3:
                if self.modeCnt > 30:
                    self.nextState()
                else:
                    self.modeCnt += 1
        elif self.state == 6:
            # 上に移動
            self.body.y -= 2
            if self.body.y < self.body_min_y:
                self.body.y = self.body_min_y
                self.nextState()
            self.setBodyAnchorPos()
        elif self.state == 7:
            # 上端からショットを打ちながら下端まで移動
            self.body.y += 1
            if self.body.y > self.body_max_y:
                self.body.y = self.body_max_y
                self.nextState()
            elif self.cnt % self.mainShotCycle == 0:
                ObjMgr.addObj(Boss3Shot(self.x, self.body.y + 12, 4))
                ObjMgr.addObj(Boss3Shot(self.x, self.body.y + 37, 4))
                enemyOthers.Spark1.create(self.body, 2, 12,
                                          gcommon.C_LAYER_E_SHOT)
                enemyOthers.Spark1.create(self.body, 2, 37,
                                          gcommon.C_LAYER_E_SHOT)
                BGM.sound(gcommon.SOUND_SHOT2)
            self.setBodyAnchorPos()
        elif self.state == 8:
            # 中心に移動
            self.body.y -= 1
            if self.body.y < 72:
                self.body.y = 72
                self.nextState()
            self.setBodyAnchorPos()
        elif self.state == 9:
            # 体当たり・戻る
            if self.mode == 0:
                # 体当たり
                self.x -= 4
                if self.x <= -8:
                    self.x = -8
                    self.nextMode()
            elif self.mode == 1:
                # 左端まで移動した後の停止状態
                if self.modeCnt > 30:
                    self.nextMode()
                else:
                    self.modeCnt += 1
            elif self.mode == 2:
                # 戻る
                self.x += 2
                if self.x >= 256 - 88:
                    self.x = 256 - 88
                    self.setState(2)
                    self.cycleCount += 1
            self.setBodyAnchorPos()

        r = random.randrange(0, 15)
        if r == 0:
            enemy.Splash.appendParam(self.x + 16,
                                     self.y,
                                     gcommon.C_LAYER_GRD,
                                     math.pi - math.pi / 32,
                                     math.pi / 16,
                                     speed=6.0,
                                     lifeMin=20,
                                     lifeMax=50,
                                     count=10,
                                     color=10)
        elif r == 5:
            enemy.Splash.appendParam(self.x + 16,
                                     self.y + 176,
                                     gcommon.C_LAYER_GRD,
                                     math.pi + math.pi / 32,
                                     math.pi / 16,
                                     speed=6.0,
                                     lifeMin=20,
                                     lifeMax=50,
                                     count=10,
                                     color=10)

        # マップループ
        if gcommon.map_x >= 6800 + 256:
            gcommon.map_x -= 8 * 4
コード例 #25
0
    def update(self):
        if self.state == 0:
            if self.x <= 170:
                self.nextState()
        elif self.state == 1:
            if self.cnt == 80:
                self.layer = gcommon.C_LAYER_SKY
                self.ground = False
                self.dx = 0.05
                self.dy = 0.0
                self.nextState()
        elif self.state == 2:
            self.x += self.dx
            self.y += self.dy
            if self.x > 150:
                self.dx = 0
                self.hp = boss.BOSS_2_HP  # ここでHPを入れなおす
                self.setState(4)
                gcommon.debugPrint("x=" + str(self.x) + " y=" + str(self.y) +
                                   " dx=" + str(self.dx) + " dy=" +
                                   str(self.dy))
        elif self.state == 4:
            self.x += self.dx
            self.y += self.dy
            self.brake = False
            mode = boss2tbl[self.tblIndex][0]
            if mode == 0:
                if self.subcnt == boss2tbl[self.tblIndex][3]:
                    self.nextTbl()
            elif mode == 1:
                if self.x < boss2tbl[self.tblIndex][3]:
                    self.dx *= 0.95
                    self.dy *= 0.95
                    self.brake = True
                    if abs(self.dx) < 0.01:
                        self.dx = 0
                        self.nextTbl()
                else:
                    self.addDxDy()
            elif mode == 2:
                if self.x > boss2tbl[self.tblIndex][3]:
                    self.dx *= 0.95
                    self.dy *= 0.95
                    self.brake = True
                    if abs(self.dx) < 0.01:
                        self.dx = 0
                        self.nextTbl()
                else:
                    self.addDxDy()
            elif mode == 3:
                # 上制限(上移動)
                if self.y < boss2tbl[self.tblIndex][3]:
                    self.dx *= 0.95
                    self.dy *= 0.95
                    self.brake = True
                    if abs(self.dy) <= 0.01:
                        self.nextTbl()
                else:
                    self.addDxDy()
            elif mode == 4:
                # 下制限(下移動)
                if self.y > boss2tbl[self.tblIndex][3]:
                    self.dx *= 0.95
                    self.dy *= 0.95
                    self.brake = True
                    if abs(self.dy) <= 0.01:
                        self.nextTbl()
                else:
                    self.addDxDy()
            elif mode == 5:
                # 触手伸ばす
                if self.subcnt == 1:
                    self.feelers[0].subDr = -1
                    self.feelers[1].subDr = 1
                    self.feelers[2].subDr = -1
                    self.feelers[3].subDr = 1
                    self.feelers[0].setMode(1)
                    self.feelers[1].setMode(1)
                    self.feelers[2].setMode(1)
                    self.feelers[3].setMode(1)
                if self.subcnt == boss2tbl[self.tblIndex][3]:
                    self.feelers[0].setMode(2)
                    self.feelers[1].setMode(2)
                    self.feelers[2].setMode(2)
                    self.feelers[3].setMode(2)
                    self.nextTbl()
            elif mode == 6:
                # 触手縮める
                if self.subcnt == 1:
                    self.feelers[0].setMode(3)
                    self.feelers[1].setMode(3)
                    self.feelers[2].setMode(3)
                    self.feelers[3].setMode(3)
                if self.subcnt == boss2tbl[self.tblIndex][3]:
                    self.nextTbl()
            elif mode == 100:
                # 指定インデックスに移動
                self.tblIndex = boss2tbl[self.tblIndex][3]
                self.cycleCount += 1
                self.subcnt = 0

            attack = boss2tbl[self.tblIndex][4]
            if attack == 1:
                # 触手伸ばす攻撃
                #if self.cycleCount & 1 == 0:
                if self.subcnt == 1:
                    self.shotBoss2Feeler(self.x + 16, self.y + 29,
                                         math.pi * 0.75)
                    BGM.sound(gcommon.SOUND_FEELER_GROW)
                elif self.subcnt == 20:
                    self.shotBoss2Feeler(self.x + 16, self.y + 8,
                                         math.pi * 1.25)
                elif self.subcnt == 40 and GameSession.isNormalOrMore():
                    self.shotBoss2Feeler(self.x + 50, self.y + 8,
                                         math.pi * 1.5)
                elif self.subcnt == 60 and GameSession.isHard():
                    self.shotBoss2Feeler(self.x + 50, self.y + 29,
                                         math.pi * 0.5)
            self.subcnt += 1
        elif self.state == 900:
            self.x -= 1
            if self.x <= 150:
                self.dx = 0.0
                self.dy = 0.0
                self.timerObj = enemy.Timer1.create(30)
                self.hp = boss.BOSS_2_HP
                self.setState(4)
コード例 #26
0
 def init(self):
     pyxel.image(1).load(0, 0, "assets/launch1.png")
     pyxel.image(2).load(0, 0, "assets/launch2.png")
     BGM.play(BGM.LAUNCH)
コード例 #27
0
    def update(self):
        gcommon.star_pos -= 0.2
        if gcommon.star_pos < 0:
            gcommon.star_pos += 255

        if self.state == 0:
            #self.x += self.dx
            self.dx = (self.targetX - self.x) * 0.075
            if self.dx < -2:
                self.dx = -2
            elif abs(self.dx) < 0.1:
                self.nextState()
                return
            self.x += self.dx
            gcommon.star_pos += self.dx
            #if self.x > -120:
            #	self.nextState()
            #if self.y <gcommon.MYSHIP_START_Y  -50:
            #	self.nextState()
        elif self.state == 1:
            self.wx = self.x + 116
            self.wy = self.y + 50
            self.nextState()
        elif self.state == 2:
            # 自機発艦準備
            if (self.y + 64) > self.my:
                self.my += 0.25
                self.y2 += 0.25
            if self.cnt > 60 and self.cnt < 90:
                self.afterBurner = 1
                BGM.sound(gcommon.SOUND_AFTER_BURNER)
            elif self.cnt >= 90:
                self.nextState()
                self.mdx = 1
        elif self.state == 3:
            # 発艦
            self.x += self.dx
            gcommon.star_pos += self.dx
            if self.dx > -3:
                self.dx -= 0.25
            self.mx += self.mdx
            if self.cnt > 90:
                self.afterBurner = 2
                self.mdx -= 0.01
            if self.cnt & 7 == 0 and self.mdx > 0 and self.mx < 150:
                self.objs.append(
                    enemy.Particle1(self.mx, self.my + 10,
                                    math.pi + math.pi / 8, 8, 50))

            if self.mdx <= -1.5:
                self.nextState()
        elif self.state == 4:
            self.x += -3

            self.dx = (gcommon.MYSHIP_START_X - self.mx) * 0.1
            if self.dx < -3:
                self.dx = -3
            gcommon.star_pos += self.dx
            self.mdx = (gcommon.MYSHIP_START_X - self.mx) * 0.1
            if self.mdx < -1.5:
                self.mdx = -1.5
            self.mx += self.mdx
            if int(self.mx) == gcommon.MYSHIP_START_X:
                gcommon.app.startMainGame()

        newObjs = []
        for obj in self.objs:
            if obj.removeFlag == False:
                obj.update()
                newObjs.append(obj)
        self.objs = newObjs

        self.cnt += 1
コード例 #28
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
コード例 #29
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
コード例 #30
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