def update(self): if self.cnt >= 6 * 60: self.cnt = 0 gcommon.map_y = 0 self.timer += 1 if self.timer >= 60 * 3600: self.timer = 0 gcommon.map_y += 0.4 if self.state == 0: if gcommon.checkShotKey() and self.timer > 30: if self.menuPos == 0: gcommon.sound(gcommon.SOUND_GAMESTART) self.state = 1 self.cnt = 0 else: gcommon.app.startOption() #app.startStageClear() if gcommon.checkUpP() or gcommon.checkDownP(): self.menuPos = (self.menuPos + 1) & 1 else: # GAME START if self.cnt > 40: gcommon.app.startGame(gcommon.START_STAGE) self.cnt += 1
def create_explosion(cx, cy, exlayer, exptype): if exptype==gcommon.C_EXPTYPE_SKY_S or exptype==gcommon.C_EXPTYPE_GRD_S: #pyxel.play(1, 2) gcommon.sound(gcommon.SOUND_SMALL_EXP) else: #pyxel.play(1, 1) gcommon.sound(gcommon.SOUND_MID_EXP) #add(objs,explosion:new(cx,cy,exlayer,exptype)) gcommon.ObjMgr.objs.append(Explosion(cx,cy,exlayer,exptype))
def boss1_shot_cross(self): if self.cnt % 60 ==0: gcommon.sound(gcommon.SOUND_SHOT2) if self.cnt % 120==0: self.sd=1 shot_cross(self.x+18*2, self.y+12*2, 8) else: self.sd=0 shot_cross(self.x+18*2, self.y+12*2, 0)
def update(self): if self.state == 0: if self.cnt == 0: gcommon.sound(gcommon.SOUND_BOSS_EXP) elif self.cnt>170: #self.nextState() self.remove() #pyxel.play(1, 5) elif self.state == 1: if self.cnt>20: self.remove()
def my_broken(self): gcommon.ObjMgr.myShip.sub_scene = 2 gcommon.ObjMgr.myShip.cnt = 0 gcommon.power = gcommon.START_MY_POWER gcommon.bomRemain = gcommon.START_BOM_REMAIN #sfx(4) #pyxel.play(0, 4) gcommon.sound(gcommon.SOUND_LARGE_EXP) m = gcommon.ObjMgr.myShip enemy.create_item(m.x + (m.right - m.left) / 2, m.y + (m.bottom - m.top) / 2, gcommon.C_ITEM_PWUP)
def update(self): if self.state==1: self.cnt += 1 if self.cnt>15: #pyxel.play(0, 5) gcommon.sound(gcommon.SOUND_BOM_EXP) self.state=2 self.cnt=0 elif self.state==2: self.cnt+=1 if self.cnt>60: self.state=0 self.cnt=0 self.removeFlag = True
def update(self): self.x = int(self.outside.x) + 48 self.y = int(self.outside.y) + 48 if self.cnt % 28 == 0: shot_cross(self.x+32, self.y-8, self.crosscnt) gcommon.sound(gcommon.SOUND_SHOT2) self.crosscnt += 3 #self.dr1 = gcommon.get_atan_no_to_ship(self.x + 67, self.y + 37) #print("dr " + str(self.dr1)) #enemy.enemy_shot_dr(self.x + 67, self.y + 37, 2, 0, self.dr1) #enemy.enemy_shot(self.x+67, self.y+37,2,0) pass if self.state == 0: if self.cnt == 1: self.dr1 = gcommon.get_atan_no_to_ship(self.x + 80, self.y + 48) if self.cnt & 7 ==7 and self.shotcnt < 4: enemy.enemy_shot_dr(self.x + 80, self.y + 48, 4, 0, self.dr1) gcommon.sound(gcommon.SOUND_SHOT2) self.shotcnt += 1 if self.cnt == 50: self.cnt = 0 self.shotcnt = 0 self.state = 1 elif self.state == 1: if self.cnt == 1: self.dr2 = gcommon.get_atan_no_to_ship(self.x -16, self.y + 48) if self.cnt & 7 ==7 and self.shotcnt < 4: enemy.enemy_shot_dr(self.x -16, self.y + 48, 4, 0, self.dr2) gcommon.sound(gcommon.SOUND_SHOT2) self.shotcnt += 1 if self.cnt == 50: self.cnt = 0 self.shotcnt = 0 self.state = 0
def shot(self): if len(gcommon.ObjMgr.shotGroups) < self.shotMax: shotGroup = MyShotGroup() if gcommon.power == 1: gcommon.ObjMgr.shots.append(shotGroup.append(self.createShot(self.x-6, self.y -8, 0, -8))) gcommon.ObjMgr.shots.append(shotGroup.append(self.createShot(self.x+6, self.y -8, 0, -8))) elif gcommon.power == 2: gcommon.ObjMgr.shots.append(shotGroup.append(self.createShot(self.x, self.y -8, 0, -8))) gcommon.ObjMgr.shots.append(shotGroup.append(self.createShot(self.x-8, self.y -8, -0.4, -7.6))) gcommon.ObjMgr.shots.append(shotGroup.append(self.createShot(self.x+8, self.y -8, 0.4, -7.6))) elif gcommon.power == 3: gcommon.ObjMgr.shots.append(shotGroup.append(self.createShot(self.x, self.y -8, 0, -8))) gcommon.ObjMgr.shots.append(shotGroup.append(self.createShot(self.x-8, self.y -8, -0.4, -7.6))) gcommon.ObjMgr.shots.append(shotGroup.append(self.createShot(self.x+8, self.y -8, 0.4, -7.6))) gcommon.ObjMgr.shots.append(shotGroup.append(self.createShot(self.x-8, self.y -8, -1, -7))) gcommon.ObjMgr.shots.append(shotGroup.append(self.createShot(self.x+8, self.y -8, 1, -7))) else: return #if pyxel.play_pos(0) == -1: # pyxel.play(0, 0) gcommon.sound(gcommon.SOUND_SHOT) gcommon.ObjMgr.shotGroups.append(shotGroup)
def update(self): st = self.state if st<10: if gcommon.map_y >= (680+17*8)*2: # scroll loop gcommon.map_y = (632+17*8)*2 else: if gcommon.map_y>=2048*2: # scroll loop gcommon.map_y=1280*2 if st==0: if self.cnt>270: self.cnt=0 self.state=1 #-gcommon.cur_scroll=0 elif st==1: if self.subcnt==0: self.y -= 0.1*2 else: self.y-=gcommon.cur_scroll if self.cnt % 10 == 0: #add(objs,material:new( # self.x-16+(6-self.material_cnt)*4,self.y+8)) #add(objs,material:new( # self.x+41-(6-self.material_cnt)*4,self.y+8)) gcommon.ObjMgr.objs.append( Material(self.x-16*2+(6-self.material_cnt)*4*2, self.y+8*2)) gcommon.ObjMgr.objs.append( Material(self.x+41*2+(6-self.material_cnt)*4*2, self.y+8*2)) self.material_cnt-=1 if self.material_cnt==0: self.cnt=0 self.state=2 if self.cnt%60==0: boss2_shot_offset(self) elif st==2: if self.subcnt==0: self.y-=0.3 else: self.y-=gcommon.cur_scroll if self.cnt%60==0: boss2_shot_offset(self) if self.cnt>60: self.cnt=0 self.state=3 self.subcnt+=1 if self.subcnt>2: self.state=4 elif st==3: if self.subcnt==0: self.y -= 0.4 else: self.y-=gcommon.cur_scroll if self.material_cnt<6: #-self.material_offset+=1 if self.cnt % 6 == 0: self.material_cnt+=1 if self.cnt%30==0: boss2_shot_offset(self) if self.cnt>60: self.cnt=0 self.state=1 elif st==4: self.y -= gcommon.cur_scroll if self.cnt%30==0: boss2_shot_offset(self) if self.cnt>60: self.cnt=0 self.state=5 self.dx=-0.2 gcommon.cur_scroll=0.4 elif st==5: self.y -= gcommon.cur_scroll self.y += self.dx self.dx-=0.025 if self.cnt>60: self.cnt=0 self.state=6 boss2_shot_offset(self) elif st==6: self.y -= gcommon.cur_scroll #gcommon.cur_scroll+=0.05 gcommon.cur_scroll+=0.1 if self.cnt>60: self.cnt=0 self.state=7 elif st==7: self.y -= gcommon.cur_scroll if self.y < 8: self.y += 0.2 if self.cnt%30==0: boss2_shot_offset(self) if self.cnt>420: self.cnt=0 self.state=10 self.hp=2000 gcommon.draw_star = True elif st==10: self.y -= gcommon.cur_scroll if self.cnt==120: self.state=11 self.cnt=0 self.layer = gcommon.C_LAYER_SKY self.subcnt=0 #--create_explosion( #-- self.x+8, #-- self.y+16, #-- c_layer_sky,c_exptype_sky_m) #--create_explosion( #-- self.x+24, #-- self.y+16, #-- c_layer_sky,c_exptype_sky_m) elif st==11: #-- wait #--if self.cnt>60 then #-- self.cnt=0 self.state=12 #--end nextstate(self, 60, 12) elif st==12: if self.cnt%10==0: dr=0 if self.subcnt%2==1: dr+=1 if self.cnt%20==0: dr+=2 shot_radial(self, dr) nextstate(self, 120, 13) elif st==13: self.x-=0.5 self.y-=0.125 if self.x<4: self.state=14 self.cnt=0 self.dr=2 elif st==14: self.x+=1 #0.5 boss2_shot_side(self) if self.cnt%8==0: enemy.enemy_shot_dr( \ self.x+17*2, \ self.y+12*2, \ 2*2, 1, (self.dr & 63)) self.dr+=1 if self.x>96*2: self.state=15 self.dr=32 elif st==15: self.x-=1 #0.5 boss2_shot_side(self) if self.cnt%8==0: enemy.enemy_shot_dr( self.x+17*2, self.y+12*2, 2*2, 1, (self.dr & 63)) self.dr-=1 if self.x<4*2: self.state=16 self.cnt=0 elif st==16: if self.x<63-14: self.x+=0.5 if self.y<4: self.y+=0.125 if self.cnt>120: self.cnt=0 self.state=12 self.subcnt+=1 elif st==102: #sfx(4) #--circfill(self.x+(self.r-self.l)/2, #-- self.y+(self.b-self.u)/2, self.cnt,7) if self.cnt>150: self.state=103 self.cnt=0 #pyxel.play(1, 5) gcommon.sound(gcommon.SOUND_LARGE_EXP) elif st==103: if self.cnt>240: self.state=104 self.cnt=0 #--gcommon.cur_scroll=0.2 gcommon.ObjMgr.objs.append(enemy.StageClearText(2)) elif st==104: if self.cnt>240: self.removeFlag = True gcommon.app.startStage(3)
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): self.setState(100) # 当たり判定がないレイヤに移動しないと何度もbrokenが呼ばれてしまう self.layer = gcommon.C_LAYER_HIDE_GRD enemy.Splash.append(gcommon.getCenterX(self), gcommon.getCenterY(self), gcommon.C_LAYER_EXP_SKY) gcommon.sound(gcommon.SOUND_LARGE_EXP)
def update(self): if self.state == 0: # 格納庫 if self.cnt == 80: self.nextState() elif self.state == 1: # 初期位置まで移動 if abs(self.firstY - self.y) < 1 and abs(self.firstX - self.x) < 1: self.nextState() self.dx = 0 self.dy = 0 else: r = math.atan2(self.firstY - self.y, self.firstX - self.x) self.dx = math.cos(r) * 1 self.dy = math.sin(r) * 1 self.x += self.dx self.y += self.dy elif self.state == 2: self.brake = False if self.cnt == 60: self.nextState() elif self.state == 3: self.x += self.dx self.y += self.dy self.brake = False mode = boss3Btbl[self.tblIndex][0] if mode == 0: if self.subcnt == boss3Btbl[self.tblIndex][3]: self.nextTbl() elif mode == 1: if self.x < boss3Btbl[self.tblIndex][3]: self.dx *= 0.95 self.dy *= 0.95 self.brake = True if abs(self.dx) < 0.01: self.nextTbl() else: self.addDxDy() elif mode == 2: if self.x > boss3Btbl[self.tblIndex][3]: self.dx *= 0.95 self.dy *= 0.95 self.brake = True if abs(self.dx) < 0.01: self.nextTbl() else: self.addDxDy() elif mode == 3: # 上制限(上移動) if self.y < boss3Btbl[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 > boss3Btbl[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() attack = boss3Btbl[self.tblIndex][4] if attack == 1: # 全体攻撃 if self.subcnt & 7 == 0: enemy.enemy_shot_dr(self.x +24, self.y + 18, 6, 1, 49 + (self.subcnt>>3)*2) enemy.enemy_shot_dr(self.x +24, self.y + 18, 6, 1, 47 - (self.subcnt>>3)*2) gcommon.sound(gcommon.SOUND_SHOT2) elif attack == 2: # 正面攻撃 if self.subcnt & 15 == 0: enemy.enemy_shot_dr(self.x +24 +16, self.y + 32, 4, 1, 16) enemy.enemy_shot_dr(self.x +24 -16, self.y + 32, 4, 1, 16) gcommon.sound(gcommon.SOUND_SHOT2) elif attack == 3: # 波状攻撃 if self.subcnt & 15 == 0: if self.subcnt & 31 == 0: for i in range(1,6): enemy.enemy_shot_offset(self.x+24, self.y+18, 2*2,1, -(i-2)*2) gcommon.sound(gcommon.SOUND_SHOT2) else: for i in range(1,6): enemy.enemy_shot_offset(self.x+24, self.y+18, 2*2,1, (i-2)*2) gcommon.sound(gcommon.SOUND_SHOT2) elif attack == 4: # 時計回り攻撃 if self.subcnt & 7 == 0: enemy.enemy_shot_dr(self.x +24, self.y + 18, 5, 1, (self.subcnt>>3)+2) enemy.enemy_shot_dr(self.x +24, self.y + 18, 6, 1, (self.subcnt>>3)-2) gcommon.sound(gcommon.SOUND_SHOT2) elif attack == 5: # 反時計回り攻撃 if self.subcnt & 7 == 0: enemy.enemy_shot_dr(self.x +24, self.y + 18, 6, 1, (34 -(self.subcnt>>3))) enemy.enemy_shot_dr(self.x +24, self.y + 18, 5, 1, (30 -(self.subcnt>>3))) gcommon.sound(gcommon.SOUND_SHOT2) self.subcnt+=1 elif self.state == 100: # broken self.dx = 0 self.dy = 0 self.subcnt = 0 if self.cnt > 120: gcommon.ObjMgr.objs.append(Boss3Explosion(gcommon.getCenterX(self), gcommon.getCenterY(self), gcommon.C_LAYER_EXP_GRD)) gcommon.score+=self.score self.nextState() elif self.state == 101: if self.cnt > 300: self.nextState() elif self.state == 102: gcommon.ObjMgr.objs.append(enemy.StageClearText(3)) if self.cnt > 240: self.nextState() elif self.state == 103: self.remove() gcommon.app.startGameClear()
def catch_item(self, obj): if obj.itype == gcommon.C_ITEM_PWUP: #pyxel.play(0, 7) gcommon.sound(gcommon.SOUND_PWUP) if gcommon.power < 3: gcommon.power += 1