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 __init__(self, x, y): super(BossFactoryShot1, self).__init__() self.x = x self.y = y self.dr = -1 self.left = 5 self.top = 5 self.right = 17 self.bottom = 17 self.hp = 15 self.layer = gcommon.C_LAYER_E_SHOT self.hitCheck = True self.shotHitCheck = True self.enemyShotCollision = False self.speed = 1 self.image = 2 self.imageX = 0 self.imageY = 96 self.maxSpeed = 4 if GameSession.isHard() else 3
def attack1(self): if GameSession.isEasy(): return if self.attackCnt % 10 == 0: n = int(self.attackCnt / 10) pt = __class__.laserPointTable[n] if GameSession.isHard(): ObjMgr.addObj( boss.DelayedShotLaser1( self.x + pt[0], self.y + pt[1], -math.pi / 2 + math.pi / 4 * n + math.pi / 16)) ObjMgr.addObj( boss.DelayedShotLaser1( self.x + pt[0], self.y + pt[1], -math.pi / 2 + math.pi / 4 * n - math.pi / 16)) else: ObjMgr.addObj( boss.DelayedShotLaser1(self.x + pt[0], self.y + pt[1], -math.pi / 2 + math.pi / 4 * n)) self.attackCnt += 1 if self.attackCnt > 10 * 7: self.attackCnt = 0 self.attackState += 1
def attack0(self): if self.attackCnt % 180 == 0: # レーザー omega = math.pi / 4 if self.cnt % 360 == 0 else -math.pi / 4 if GameSession.isHard(): for i, pt in enumerate(__class__.laserPointTable): ObjMgr.addObj( boss.ChangeDirectionLaser1( self.x + pt[0], self.y + pt[1], -math.pi / 2 - math.pi / 16 + math.pi / 4 * i, omega)) else: for i, pt in enumerate(__class__.laserPointTable): if i & 1 == 0: ObjMgr.addObj( boss.ChangeDirectionLaser1( self.x + pt[0], self.y + pt[1], -math.pi / 2 - math.pi / 16 + math.pi / 4 * i, omega)) self.attackCnt += 1 if self.attackCnt >= 180: self.attackCnt = 0 self.attackState += 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 update(self): self.mover.update() if self.state == 1: if self.mover.tableIndex == 0: # STOP self.shiftPos = (self.mover.cnt/30) * 8 elif self.mover.tableIndex == 11: # STOP self.shiftPos = 8 -(self.mover.cnt/30) * 8 elif self.mover.tableIndex >= 1: if self.mover.mode == CountMover.MOVE: fx = 1 dr = 32 if self.x < ObjMgr.myShip.x: fx = -1 dr = 0 if self.cnt % 60 == 0: if GameSession.isEasy(): enemy.enemy_shot_dr_multi(self.x -48 * fx, self.y-20, 3, 0, dr, 3, 4) enemy.enemy_shot_dr_multi(self.x -48 * fx, self.y+20, 3, 0, dr, 3, 4) elif GameSession.isHard(): enemy.enemy_shot_dr_multi(self.x -48 * fx, self.y-20, 3, 0, dr, 6, 2) enemy.enemy_shot_dr_multi(self.x -48 * fx, self.y+20, 3, 0, dr, 6, 2) else: enemy.enemy_shot_dr_multi(self.x -48 * fx, self.y-20, 3, 0, dr, 4, 3) enemy.enemy_shot_dr_multi(self.x -48 * fx, self.y+20, 3, 0, dr, 4, 3) elif self.state == 2: if self.mover.tableIndex == 0: # STOP self.shiftPos = (self.mover.cnt/30) * 8 elif self.mover.tableIndex == 11: # STOP self.shiftPos = 8 -(self.mover.cnt/30) * 8 elif self.mover.tableIndex >= 1: if self.mover.mode == CountMover.MOVE: fx = 1 if self.x < ObjMgr.myShip.x: fx = -1 speed = -4.0 if self.x < ObjMgr.myShip.x: speed = 4.0 if self.cnt % 60 == 0: #enemy.enemy_shot_dr_multi(self.x -48 * fx, self.y-20, 3, 0, dr, 4, 3) #enemy.enemy_shot_dr_multi(self.x -48 * fx, self.y+20, 3, 0, dr, 4, 3) ObjMgr.addObj(BossLabyrinthShot1(self.x -48 * fx, self.y, speed)) # ObjMgr.addObj(BossLabyrinthShot1(self.x -48, self.y-20, 4)) # ObjMgr.addObj(BossLabyrinthShot1(self.x -48, self.y+20, 4)) # ObjMgr.addObj(BossLabyrinthShot1(self.x -48, self.y+20+16, 4)) if self.mover.cnt == 30: ObjMgr.addObj(BossLabyrinthBeam1(self, 32, -32, math.pi * 1.75)) ObjMgr.addObj(BossLabyrinthBeam1(self, -32, -32, math.pi * 1.25)) ObjMgr.addObj(BossLabyrinthBeam1(self, -32, 32, math.pi * 0.75)) ObjMgr.addObj(BossLabyrinthBeam1(self, 32, 32, math.pi * 0.25)) elif self.state == 100: # 破壊状態 if self.cnt % 10 == 0: enemy.create_explosion2(self.x + random.randrange(-30, 30), self.y + random.randrange(-30, 30), self.layer, gcommon.C_EXPTYPE_SKY_M, -1) if self.cnt > 120: self.mover = CountMover(self, self.moveTable101, False) self.nextState() elif self.state == 101: # 破壊状態 if self.cnt > 90: self.remove() ObjMgr.addObj(BossLabyrinth2(self.isBossRush, self.timerObj)) if self.state < 100 and self.mover.isEnd: if self.state == 0: self.setState(1) self.mover = CountMover(self, self.moveTable1, False) elif self.state == 1: self.setState(2) self.mover = CountMover(self, self.moveTable1, False) elif self.state == 2: self.setState(1) self.mover = CountMover(self, self.moveTable1, False)
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)
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)