def update(self): if self.x < -16: self.remove() return self.mover.update() if self.cnt % 25 == 0: enemy_shot(self.x, self.y +12, 3, 0)
def update(self): if self.state == 0: self.y += 1.0 self.x -= 1.0 self.bx = self.x if self.cnt > 30: self.nextState() elif self.state == 1: self.x += self.dx self.y += self.dy if self.x < 16 or self.x > 240: self.dx = -self.dx if self.cnt > 20: self.nextState() else: if self.bx < self.x: self.bx += 1 elif self.bx > self.x: self.bx -= 1 if self.cnt > 20: self.setState(1) self.cycleCount += 1 if self.cycleCount % 6 == 0: self.dx = -self.dx if self.cycleCount % 4 == 0: self.dy = -self.dy self.allCnt += 1 if self.allCnt % self.shotInterval == 0 and self.state in (1, 2): enemy.enemy_shot(self.x + 8, self.y + 8, 2, 0)
def update(self): self.mover.update() #gcommon.debugPrint("x = " + str(self.x) + " y = " + str(self.y)) if self.x < -16 or self.x > gcommon.SCREEN_MAX_X + 16: self.remove() return if self.cnt == self.shotFirst: enemy.enemy_shot(self.x + 10, self.y + 10, 2, 0)
def update(self): self.x -= 1.5 if self.x < -24: self.remove() self.y = self.y + self.dy self.dy = gcommon.sin_table[int(self.dr64)] * 1.2 self.dr64 = math.fmod(self.dr64 + 0.5, 63) if self.cnt == self.first: enemy.enemy_shot(self.x + 5, self.y + 12, 2, 0) self.imageIndex = (self.cnt >> 3) & 3
def update(self): if self.cnt > 900: self.remove() else: if self.launcherTime < self.cnt and self.cnt % 4 == 0 and self.cnt < 180: dr = gcommon.get_direction_my(self.x + 8, self.y + 8) self.dx = gcommon.direction_map[dr][0] * 1.25 self.dy = -gcommon.direction_map[dr][1] * 1.25 self.x += self.dx self.y += self.dy if self.cnt % 90 == 89 and self.shotFlag: enemy.enemy_shot(self.x + 8, self.y + 8, 2, 0)
def update(self): self.x += self.dx self.y += self.dy if (self.x <= 2 and self.dx < 0) or (self.x >= gcommon.SCREEN_MAX_Y - 2 and self.dx > 0): self.dx = -self.dx if (self.y < (72 * 8 - gcommon.map_y) and self.dy < 0) or ( (self.y + 16) > (gcommon.waterSurface_y - gcommon.map_y) and self.dy > 0): self.dy = -self.dy self.allCnt += 1 if self.allCnt % self.shotInterval == 0: enemy.enemy_shot(self.x + 8, self.y + 8, 2, 0)
def update(self): if self.x <= -24: self.remove() return if self.state == 0 and self.cnt == self.firstShot: self.setState(1) if self.state == 1: if self.cnt == 10: enemy.enemy_shot(self.x +12.5, self.y + self.mirror * 24, 2, 0) elif self.cnt > 30: self.state = 2 elif self.state == 2: if self.cnt == self.shotInterval: self.setState(1)
def update(self): self.mover.update() if self.mover.isEnd: self.remove() return if self.mover.mode == CountMover.STOP: if self.mover.cnt == 20: enemy_shot(self.x + (self.right - self.left) / 2, self.y + (self.bottom - self.top) / 2, 2, 0) if self.mover.dx < 0.0: self.fdx = 1 elif self.mover.dx > 0.0: self.fdx = -1 self.x = self.parent.x + self.mover.x self.y = self.parent.y + self.mover.y
def update(self): if self.bossobj.state==11 and self.bossobj.cnt>0: if self.flag: self.x+=2 else: self.x-=2 self.y = self.bossobj.y if gcommon.is_outof_bound(self): self.removeFlag = True else: self.x = self.bossobj.x+self.cx self.y = self.bossobj.y if self.brokenflag==0 and self.bossobj.state>0 and self.bossobj.state<=10: if self.cnt%60 ==0: enemy.enemy_shot(self.x+8*2,self.y+35*2,2,1)
def update(self): self.mover.update() if self.x <= -96 or self.x >= gcommon.SCREEN_MAX_X+96 or self.y <= -96 or self.y >= gcommon.SCREEN_MAX_Y+96: #gcommon.debugPrint("remove MovableBattery1p") self.remove() return if self.firstShot == self.cnt or (self.cnt > self.firstShot and (self.cnt - self.firstShot) % self.shotInterval == 0): if self.shotState == 0: self.shotState = 1 if self.shotState >= 1: self.shotCnt += 1 if self.shotCnt > 5: self.shotCnt = 0 self.shotState += 1 if self.shotState == 4 and gcommon.isShotMapPos(self.x, self.y): enemy.enemy_shot(self.x, self.y, 3, 0) elif self.shotState >= 8: self.shotState = 0
def update(self): if self.state == 0: self.upDownFlag = False self.move() if self.upDownFlag == False: if ObjMgr.myShip.x + myShip.MyShipBase.CENTER_X >= 128: # 画面右側 l = abs(ObjMgr.myShip.y + myShip.MyShipBase.CENTER_Y - self.y) if self.x > ObjMgr.myShip.x + myShip.MyShipBase.CENTER_X - l: self.nextState() else: # 画面左側 l = abs(ObjMgr.myShip.y + myShip.MyShipBase.CENTER_Y - self.y) if self.x > ObjMgr.myShip.x + myShip.MyShipBase.CENTER_X + l + 40: self.nextState() elif self.state == 1: self.dx = 0 if self.cnt == 20: enemy.enemy_shot(self.x, self.y, 2, 0) elif self.cnt >= 60: self.cycleCount += 1 if self.cycleCount > 3: # 撤退 self.direction = -1 self.nextState() else: #self.direction = -1 * self.direction self.setState(0) elif self.state == 2: # 撤退 self.move() if self.x > 256 or self.x < -32: self.remove() #gcommon.debugPrint("cnt=" + str(self.frameCount) + " " + str(self.y)) return
def update(self): self.x = self.parentObj.x + self.offsetX self.y = self.parentObj.y + self.offsetY if self.mode == 1: if self.state == 1: i = 1 x = 0 y = 0 for pos in self.cells: pos[0] = x + math.cos( gcommon.atan_table[int(self.dr + i * self.subDr) & 63]) * 12 * (self.cnt) / 30.0 pos[1] = y + math.sin( gcommon.atan_table[int(self.dr + i * self.subDr) & 63]) * 12 * (self.cnt) / 30.0 x = pos[0] y = pos[1] i += 1 if self.cnt == 30: self.state = 2 elif self.mode == 2: # ゆらゆら動く if self.state == 1: self.subDr = 0.0 self.state = 2 elif self.state == 2: i = 0 x = 0 y = 0 for pos in self.cells: pos[0] = x + math.cos(gcommon.atan_table[ (int(self.dr + i * self.subDr)) & 63]) * 12 pos[1] = y + math.sin(gcommon.atan_table[ (int(self.dr + i * self.subDr)) & 63]) * 12 x = pos[0] y = pos[1] i += 1 self.subDr += 0.05 if self.subDr >= 3.0: self.state = 3 elif self.state == 3: i = 0 x = 0 y = 0 for pos in self.cells: pos[0] = x + math.cos(gcommon.atan_table[ (int(self.dr + i * self.subDr)) & 63]) * 12 pos[1] = y + math.sin(gcommon.atan_table[ (int(self.dr + i * self.subDr)) & 63]) * 12 x = pos[0] y = pos[1] i += 1 self.subDr -= 0.05 if self.subDr <= -3.0: self.state = 2 if self.cnt % self.shotCycle == 0: if len(self.cells) > 0: pos = self.cells[len(self.cells) - 1] enemy.enemy_shot(self.x + pos[0] + 8, self.y + pos[1] + 8, 2, 0) elif self.mode == 3: # 縮む if self.state == 1: #print("cnt = " + str(self.cnt)) i = 1 x = 0 y = 0 for pos in self.cells: pos[0] = x + math.cos( gcommon.atan_table[int(self.dr + i * self.subDr) & 63]) * 12 * (30 - self.cnt) / 30.0 pos[1] = y + math.sin( gcommon.atan_table[int(self.dr + i * self.subDr) & 63]) * 12 * (30 - self.cnt) / 30.0 x = pos[0] y = pos[1] i += 1 if self.cnt == 30: self.state = 0
def boss2_shot_side(self): if self.subcnt>=1 and self.cnt%80==0: enemy.enemy_shot(self.x,self.y+18*2,2,0) enemy.enemy_shot(self.x+31*2,self.y+18*2,2,0)
def update(self): if gcommon.game_timer==3720: gcommon.cur_scroll=0 if gcommon.is_outof_bound(self): self.removeFlag = True else: if self.state==0: if self.cnt>240: self.cnt=0 self.state=1 elif self.state==1: if gcommon.cur_scroll==0: self.y -= 0.5 * 2 elif self.cnt & 64==0: self.y -= 0.35 * 2 self.boss1_shot_cross() if self.y<=0: self.state=2 self.cnt=0 elif self.state==2: remove_all_battery() if self.subcnt==0: self.hp=1000 if self.cnt & 7==7 and self.cnt & 127 !=127: enemy.enemy_shot( \ self.x+18*2 +math.cos(gcommon.atan_table[self.cnt & 63])*8, \ self.y+10*2 +math.sin(gcommon.atan_table[self.cnt & 63])*8, \ 2*2,1) gcommon.sound(gcommon.SOUND_SHOT2) self.sd = (self.cnt & 4)>>2 if self.cnt==300: self.state=3 self.cnt=0 elif self.state==3: if self.cnt & 15 ==15: shot_cross(self.x+18*2, self.y+12*2, self.cnt>>2) gcommon.sound(gcommon.SOUND_SHOT2) self.sd = (self.cnt & 4)>>2 if self.cnt==300: self.state=4 self.subcnt = 0 self.cnt=0 elif self.state==4: if self.cnt & 31== 31: if self.cnt & 63==63: for i in range(1,6): enemy.enemy_shot_offset(self.x+18*2, self.y+10*2, 2*2,1,(i-3)*2) else: for i in range(1,7): enemy.enemy_shot_offset(self.x+18*2, self.y+10*2, 2*2,1,(i-4)*2+1) gcommon.sound(gcommon.SOUND_SHOT2) if self.cnt==120: create_battery1(12*2,16*2,1) create_battery1(28*2,16*2,240) create_battery1(92*2,16*2,240) create_battery1(108*2,16*2,1) if self.cnt==300: self.state=5 self.cnt=0 ## self.subcnt+=1 # if self.subcnt==1: # self.state=5 # create_battery1(12*2,16*2,1) # create_battery1(28*2,16*2,240) # create_battery1(92*2,16*2,240) # create_battery1(108*2,16*2,1) # self.cnt=0 # self.subcnt=0 # else: # self.subcnt = 0 # self.state=2 # self.cnt=0 # elif self.state==5: self.y += 0.25*2 self.boss1_shot_cross() if self.y>=50: self.state=6 self.cnt=0 elif self.state==6: self.boss1_shot_cross() if self.cnt==300: self.state=7 self.cnt=0 elif self.state==7: self.y -= 0.25*2 self.boss1_shot_cross() if self.y<=8: self.state=2 self.cnt=0 self.subcnt+=1 elif self.state==100: if self.cnt>120: self.state=101 self.cnt=0 elif self.state==101: if self.cnt % 12 == 0: enemy.create_explosion( self.x+(self.right-self.left)/2 +random.randrange(36)-18, self.y+(self.bottom-self.top)/2 +random.randrange(24)-12, self.layer,gcommon.C_EXPTYPE_GRD_M) if self.cnt>240: self.state=102 self.cnt=0 #pyxel.play(1, 5) gcommon.sound(gcommon.SOUND_LARGE_EXP) elif self.state==102: #sfx(4) if self.cnt>150: self.state=103 self.cnt=0 elif self.state==103: if self.cnt>180: self.state=104 self.cnt=0 gcommon.cur_scroll=0.4 gcommon.ObjMgr.objs.append(enemy.StageClearText(1))
def broken(self): super().broken() if GameSession.difficulty == gcommon.DIFFICULTY_HARD: enemy.enemy_shot(self.x, self.y, 2, 0)
def update(self): self.subCnt += 1 if self.rolling: self.rad += self.omega if self.rad >= math.pi * 2: self.rad -= math.pi * 2 elif self.rad < 0.0: self.rad += math.pi * 2 if self.state == 0: if self.subState == 0: # 後ろから落下 self.x += self.dx self.y += self.dy self.dy += 0.2 if self.y > 80: # 跳ねる self.dy = -self.dy * 0.8 for i in range(3): enemy.Particle1.append(self.x + 39.5, self.y + 88, -math.pi / 4 - math.pi / 4 * i) #ObjMgr.objs.append( # enemy.Particle1(self.x +39.5, self.y +88, -math.pi/4 -math.pi/4*i)) if self.x > 280: self.dx = -self.dx # 回転を逆にする self.omega = -math.pi / 128 self.setSubState(1) elif self.subState == 1: # 右端から戻ってくる self.x += self.dx self.y += self.dy self.dy += 0.2 if self.y > 80: # 跳ねる self.dy = -self.dy for i in range(4): ObjMgr.objs.append( enemy.Particle1(self.x + 39.5, self.y + 88, -math.pi / 4 - math.pi / 4 * i, 8, 50)) if self.x <= 152: self.omega = -math.pi / 64 self.setSubState(2) elif self.subState == 2: # 規定位置まで移動 self.y -= 1 if self.y < 50: self.y = 50 if self.subCnt > 30: self.dx = 0 self.dy = -2 self.moveState = 0 # 0:上に移動 self.nextState() elif self.state == 1: if self.subState == 0: # 待ち if self.subCnt == 30: self.setSubState(1) elif self.subState == 1: # 開く self.distance += 0.5 if self.distance > 38: self.setSubState(2) elif self.subState == 2: # 開いている(攻撃) if self.stateCycle & 1 == 0: # 最初(奇数)のサイクル if self.finMode == 0: if self.subCnt & 7 == 0: # バラバラ弾 for i in range(4): enemy.enemy_shot( self.x + 39.5 + math.cos(self.rad + math.pi / 2 * i) * 32, self.y + 39.5 + math.sin(self.rad + math.pi / 2 * i) * 32, 4, 0) else: if self.subCnt % 15 == 0: for i in range(4): # 破壊可能な自動追尾泡?ショット ObjMgr.objs.append( BossFactoryShot1( self.x + 39.5 + math.cos(self.rad + math.pi / 4 + math.pi / 2 * i) * 32, self.y + 39.5 + math.sin(self.rad + math.pi / 4 + math.pi / 2 * i) * 32)) if self.subCnt == 30: self.setSubState(3) else: # 偶数サイクル if self.finMode == 0: if self.subCnt == 1: self.omega = math.pi / 64 # 卍のように撃つ if self.subCnt % __class__.roundShotInterval[ GameSession.difficulty] == 1: rr = 0 if self.finMode == 0 else math.pi / 4 for i in range(4): px = self.x + 39.5 + math.cos( self.rad + rr + math.pi / 2 * i) * 32 py = self.y + 39.5 + math.sin( self.rad + rr + math.pi / 2 * i) * 32 no = gcommon.get_atan_no( self.x + 39.5, self.y + 39.5, px, py) enemy.enemy_shot_dr(px, py, 3, 0, no) #self.omega += math.pi/2400 # 弾を少しずらすため、回転を遅くする self.omega *= 0.99 else: # 弧を描くような弾 if self.subCnt % __class__.arcShotInterval[ GameSession.difficulty] == 0: for i in range(4): px = self.x + 39.5 + math.cos( self.rad + math.pi / 4 + math.pi / 2 * i) * 32 py = self.y + 39.5 + math.sin( self.rad + math.pi / 4 + math.pi / 2 * i) * 32 ObjMgr.addObj( BossFactoryShot2( px, py, self.rad + math.pi / 4 - math.pi / 2 + math.pi / 2 * i)) if self.subCnt >= 150: self.omega = -math.pi / 64 self.setSubState(3) elif self.subState == 3: # 閉まる self.distance -= 0.5 if self.distance < 22: self.distance = 22.0 self.setSubState(0) self.finMode = (self.finMode + 1) & 1 self.subStateCycle += 1 self.firstCycle = False if self.subStateCycle > 3: self.nextState() # state:1での移動 if self.subStateCycle > 1 and self.firstCycle == False: # 最初は移動しない if self.moveState == 0: # 上に移動 self.y += self.dy if self.y < 30: self.dy += 0.05 if self.dy >= 0.0: self.dy = 0.05 self.moveState = 1 elif self.dy > -2.0: self.dy -= 0.05 else: # 下に移動 self.y += self.dy if self.y > 100: self.dy -= 0.05 if self.dy <= 0.0: self.dy = -0.05 self.moveState = 0 elif self.dy < 2.0: self.dy += 0.05 elif self.state == 2: # 拡散ビーム if self.subState == 0: # 待ち if self.centerRadius >= 1: self.centerRadius -= 1 if self.subCnt > 20: self.setSubState(1) elif self.subState == 1: # 拡散ビーム? if self.cnt & 7 == 7: rad = (self.stateCycle & 1) * 2 * math.pi / 16 for i in range(64): if i & 4 == 0: ObjMgr.objs.append( boss.BossLaserBeam1(self.x + 39.5, self.y + 39.5, rad)) rad += 2 * math.pi / 64 if self.cnt > 60: self.setSubState(2) elif self.subState == 2: # 待ち if self.centerRadius < 14: self.centerRadius += 1 if self.subCnt > 30: self.setState(3) elif self.state == 3: # 自機を追いかける if self.cnt == 1: self.speed = 0.0 self.moveDr64 = -1 if self.subState == 0: # 追いかける if self.cnt % 4 == 0 and self.cnt <= 30 * GameSession.enemy_shot_rate: tempDr = gcommon.get_atan_no_to_ship( self.x + 39.5, self.y + 39.5) # 右左を決める if self.moveDr64 == -1: self.moveDr64 = tempDr else: self.moveDr64 = (self.moveDr64 + gcommon.get_leftOrRight( self.moveDr64, tempDr)) & 63 self.speed += 0.5 if self.speed >= 3.0: self.speed = 3.0 self.x += gcommon.cos_table[self.moveDr64] * self.speed self.y += gcommon.sin_table[self.moveDr64] * self.speed #if self.x < 40 or self.y < 40 or (self.x + 40 > gcommon.SCREEN_MAX_X) or (self.y +40 > gcommon.SCREEN_MAX_Y): if self.subCnt > 120: self.setSubState(1) elif self.subState == 1: # 戻る if self.subCnt == 1: pass #print("self.subState == 1") if self.cnt & 2 == 0: # 右左を決める tempDr = gcommon.get_atan_no( self.x, self.y, 152, (gcommon.SCREEN_HEIGHT - 80) / 2) self.moveDr64 = (self.moveDr64 + gcommon.get_leftOrRight( self.moveDr64, tempDr)) & 63 self.x += gcommon.cos_table[self.moveDr64] * self.speed self.y += gcommon.sin_table[self.moveDr64] * self.speed l = math.hypot(152 - self.x, (gcommon.SCREEN_HEIGHT - 80) / 2 - self.y) if l < 4: self.stateCycle += 1 # ステート1に戻る self.setState(4) elif l < 50: self.speed -= 0.25 if self.speed < 0.5: self.speed = 0.5 elif self.state == 4: if self.subState == 0: # 開く if self.distance < 38: self.distance += 0.5 #print("rad = " + str(self.rad)) if self.distance >= 38 and abs(self.rad) <= math.pi / 64: self.rad = 0.0 #self.rolling = False self.setSubState(1) self.dr64 = -1 elif self.subState == 1: if self.subCnt % __class__.homingBeamInterval[ GameSession.difficulty] == 1: # ホーミングビーム rr = 0.0 if self.finMode == 0 else math.pi / 4 i = (int(self.subCnt / 40)) & 3 for i in range(2): px = self.x + 39.5 + math.cos(self.rad + rr + math.pi * i) * 32 py = self.y + 39.5 + math.sin(self.rad + rr + math.pi * i) * 32 dr = gcommon.atan2x(px - (self.x + 39.5), py - (self.y + 39.5)) beam = enemyShot.HomingBeam1(px, py, dr) ObjMgr.addObj(beam) if self.subCnt > 160: self.setSubState(2) elif self.subState == 2: # 閉まる self.distance -= 0.5 if self.distance < 22: self.distance = 22.0 # ステート1に戻る self.setState(1) self.rolling = True elif self.state == 900: self.x -= 1 self.y = 50 if self.x <= 152: self.setState(1) #self.xpoints1 = [] #self.xpoints2 = [] self.xpolygonsList = [] # Finの座標計算 for i in range(8): distance = 22.0 if self.finMode == 0: if i & 1 == 0: distance = self.distance else: if i & 1 == 1: distance = self.distance #self.xpoints1.append(gcommon.getAnglePoints([self.x + 39.5, self.y +39.5], # bossFactoryFin1, [15.5, -distance], self.rad + math.pi/4 *i)) #self.xpoints2.append(gcommon.getAnglePoints([self.x + 39.5, self.y +39.5], # bossFactoryFin2, [15.5, -distance], self.rad + math.pi/4 *i)) self.xpolygonsList.append( gcommon.getAnglePolygons([self.x + 39.5, self.y + 39.5], self.polygonList, [15.5, -distance], self.rad + math.pi / 4 * i))