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)
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))
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 += 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): 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()
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))
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")
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))
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
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
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)
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)
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)
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)
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 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)
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 addPlayerStock(cls): __class__.playerStock += 1 BGM.sound(gcommon.SOUND_EXTENDED, gcommon.SOUND_CH1)
def update(self): if self.state < 100: self.countMover.update() if self.countMover2 != None: self.countMover2.update() if self.state == 0: # 出現 if self.countMover.tableIndex == 2 and self.cnt % 4 == 0 and self.countMover.cnt < 40: if self.countMover.cnt == 0: BGM.sound(gcommon.SOUND_WATERSPLASH) wy = gcommon.waterSurface_y - gcommon.map_y for i in range(10): enemy.WaterSplash.appendDr( self.x + 20 + i * 8, wy, gcommon.C_LAYER_SKY, math.pi * (1.2 + i * 0.6 / 10), math.pi / 6, 30) for t in __class__.boubleTable: y = self.y + t[1] if wy < y: rx = 0 if t[2] > 0: rx = random.randrange(-t[2], t[2]) ry = 0 if t[3] > 0: ry = random.randrange(-t[3], t[3]) enemy.Splash.appendDr3(self.x + t[0] + rx, y + ry, gcommon.C_LAYER_SKY, math.pi * 1.5, math.pi / 6, 1.0, 50, 100, 20) elif self.countMover.isEnd: self.countMover = enemy.CountMover(self, __class__.moveTable2, True) self.countMover2 = enemy.CountMover( self, __class__.moveTable2x, True) self.setState(1) elif self.state == 1: # 攻撃中 if self.attackState == 0: # 向きを変えるレーザー self.attack0() elif self.attackState == 1: # 待ち self.attackCnt += 1 if self.attackCnt > 240: self.attackCnt = 0 self.attackState += 1 elif self.attackState == 2: # 8方位レーザー self.attack1() elif self.attackState == 3: # 待ち self.attackCnt += 1 if self.attackCnt > 60: self.attackCnt = 0 self.attackState = 0 if self.cnt % 200 == 0: # 水中の蟲 self.worm4List = gcommon.getShrinkList(self.worm4List) if len(self.worm4List) < self.wormMax: dx = 1.0 if self.cnt % 400 == 0 else -1.0 dy = 0.20 if self.cnt % 800 == 0 else -0.25 obj = enemyCreature.Worm4(self.x + 8 * 6, self.y + 112, dx, dy) self.worm4List.append(obj) ObjMgr.addObj(obj) c = self.cnt % 320 if c % 20 == 0 and c < 80: # 蝙蝠みたいなやつ self.bat1List = gcommon.getShrinkList(self.bat1List) if len(self.bat1List) < self.batMax: dx = (self.random.rand() % 10 - 5) / 5.0 dy = -4.0 obj = enemyCreature.Worm5(self, self.x + 8 * 6, self.y + 15, dx, dy) self.bat1List.append(obj) ObjMgr.addObj(obj) elif self.state >= 100: self.updateBroken()
def update(self): # 向き self.isLeft = (self.x + 52) > ObjMgr.myShip.x self.beam = 0 if self.state == 0: self.x -= gcommon.cur_scroll_x if self.cnt % 60 == 0: self.shotFix4() if self.cnt > 260: self.nextState() elif self.state == 1: # 指定位置まで移動 self.x -= gcommon.cur_scroll_x self.x += 0.625 self.y -= 0.20 #0.125 if self.cnt % 60 == 0: self.shotFix4() if self.cnt > 270: self.nextState() elif self.state == 2: # 指定位置まで移動 self.y += 0.25 if self.cnt % 60 == 0: self.shotFix4() if self.cnt > 120: # x=159 y=36 self.nextState() gcommon.debugPrint("x = " + str(self.x) + " y = " + str(self.y)) self.hp = boss.BOSS_1_HP elif self.state == 3: # 4、8方向ショット if self.subState == 0: self.y -= 0.250 if self.y < 0: self.y = 0 else: self.y += 0.250 if self.y > 150: self.y = 150 if self.cnt & 15 == 15: if GameSession.isNormalOrLess(): self.shotFix4() else: self.shotFix8() #if self.cnt & 31 == 31: # self.shotFix4() #else: if self.cnt > 120: self.nextState() BGM.sound(gcommon.SOUND_BOSS1PREBEAM) if self.subState == 0: self.subState = 1 else: self.subState = 0 elif self.state == 4: # ビーム発射前 if self.cnt & 1 == 1: x = 50 + random.random() * 30 y = random.random() * 6 a = 200 + random.random() * 500 if self.cnt & 3 == 3: a *= -1 self.tbl.append(Boss1Star(x, y, a)) newTbl = [] for s in self.tbl: s.x -= 2 if s.x >= 0: newTbl.append(s) self.tbl = newTbl if self.cnt > 90: self.nextState() BGM.sound(gcommon.SOUND_BOSS1BEAM) elif self.state == 5: # ビーム発射開始(移動なし) self.beam = int(self.cnt / 3) + 1 if self.beam > 5: self.nextState() elif self.state == 6: # ビーム発射中(移動なし) self.beam = 6 self.beamObj.hitCheck = True if self.cnt > 60: self.nextState() elif self.state == 7: # ビーム発射中(移動あり) self.beam = 6 zy = abs(self.y + 30 - ObjMgr.myShip.y) if zy > 80: self.dy = 3 elif zy > 50: self.dy = 2 elif zy > 20: self.dy = 1 else: self.dy = 0.25 if self.y + 30 > ObjMgr.myShip.y: self.dy = -self.dy self.y += self.dy if GameSession.isNormal(): if self.cnt % 45 == 0: self.shotFix4() elif GameSession.isHard(): if self.cnt % 30 == 0: self.shotFix4() if self.cnt > self.beamTime: self.nextState() elif self.state == 8: self.dy = 0.0 # ビーム発射終了(移動なし) self.beam = 5 - int(self.cnt / 3) self.beamObj.hitCheck = False if self.beam < 0: self.setState(3) elif self.state == 900: # ボスラッシュ時の初期 self.x -= 1.0 if self.x <= 159: self.timerObj = enemy.Timer1.create(30) self.hp = boss.BOSS_1_HP self.setState(3)
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)
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
def my_broken(self): ObjMgr.myShip.sub_scene = 2 ObjMgr.myShip.cnt = 0 GameSession.destroyed += 1 BGM.sound(gcommon.SOUND_LARGE_EXP, gcommon.SOUND_CH1)
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
def doEffect(self, effectSound): # 跳弾表示 enemy.Particle1.appendShotCenter(self) if effectSound: BGM.sound(gcommon.SOUND_HIT, gcommon.SOUND_CH2)
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 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
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): 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)
def updateMode0(self): self.coreX = self.x +32+16+32 self.coreY = self.y +64+16+16 if self.state == 0: if self.x <= 256-112: # スクロール停止 gcommon.scroll_flag = False self.nextState() elif self.state == 1: if self.cnt > 40: self.nextState() elif self.state == 2: if self.cnt % 25 == 1: count = 5 n = self.cnt & 3 if n == 0: enemy.ContinuousShot.create(self.x + 38, self.y +24, self.shotType, count, 5, 4) elif n == 1: enemy.ContinuousShot.create(self.x + 66, self.y +128+15, self.shotType, count, 5, 4) elif n == 2: enemy.ContinuousShot.create(self.x + 66, self.y +49, self.shotType, count, 5, 4) elif n == 3: enemy.ContinuousShot.create(self.x + 38, self.y +128+40, self.shotType, count, 5, 4) if GameSession.isHard(): self.shotType = 1 + (self.shotType + 1) % 3 if self.cnt> 100: self.nextState() elif self.state == 3: # 4箇所からのビーム if self.cnt == 1: for i in range(4): start = BossLast1.launcherTable[i] pos = BossLast1.beamTable[self.beamIndex][i] self.beam1List[i] = BossLastBeam1(self.x + start[0], self.y +start[1], pos[0], pos[1]) ObjMgr.addObj(self.beam1List[i]) self.beamIndex += 1 if self.beamIndex >=len(BossLast1.beamTable): self.beamIndex = 0 else: if self.beam1List[0].removeFlag: self.nextState() elif self.state == 4: if self.cycleCount % 3 == 2: self.nextState() else: self.setState(2) self.cycleCount += 1 elif self.state == 5: # 本体ビーム if self.cnt == 1: self.beam2 = BossLastBeam2(180, 96, (self.cycleCount2 & 1 != 0)) ObjMgr.addObj(self.beam2) BGM.sound(gcommon.SOUND_BOSS1BEAM) self.cycleCount2 += 1 else: if self.beam2.removeFlag: if self.cycleCount2 & 2 != 0: self.nextState() else: self.setState(2) elif self.state == 6: # レーザー砲台射出 if GameSession.difficulty == gcommon.DIFFICULTY_EASY: rate = 80 elif GameSession.difficulty == gcommon.DIFFICULTY_NORMAL: rate = 60 else: rate = 40 if self.cnt % rate == 1: ObjMgr.objs.append(BossLastBattery1(156, 192, -1)) elif self.cnt % rate == int(rate/2)+1: ObjMgr.objs.append(BossLastBattery1(156, -16, 1)) if self.cnt > 200: self.setState(2) self.rad = (self.rad + math.pi/60) % (math.pi * 2)