Esempio n. 1
0
	def update(self):
		if len(self.move_tbl)>self.tbl_idx:
			t = self.move_tbl[self.tbl_idx]
			if t[1]==0:
				# no move
				pass
			else:
				self.x += gcommon.direction_map[t[1]-1][0] *0.5*2
				self.y += gcommon.direction_map[t[1]-1][1] *0.5*2
			
			if self.timer>=t[0]:
				self.tbl_idx+=1
			
		
		if gcommon.is_outof_bound(self):
			self.removeFlag = True
		else:
			if self.cnt == self.first:
				enemy_shot(self.x+14,self.y+14,2,0)
				self.first = -1
				self.cnt =0
			elif self.cnt == self.interval:
				enemy_shot(self.x+14,self.y+14,2,0)
				self.cnt =0
			
		
		self.timer+=1
Esempio n. 2
0
	def update(self):
		if self.cnt >= self.move_first:
			c = int(self.cnt/self.move_interval)
			if c % 2 == 0:
				self.x += gcommon.direction_map[self.direction][0] * self.speed *2
				self.y -= gcommon.direction_map[self.direction][1] * self.speed *2
				self.move_cnt+=1
		if gcommon.is_outof_bound(self):
			self.removeFlag = True
		else:
			# mid tank1 shot
			ox = 0
			oy = 0
			ox2 = 0
			oy2 = 0
			ox3 = 0
			oy3 = 0
			if self.direction==0 or self.direction==4:
				ox = 8
				oy = 16
				dx = 6*2
				dy = 0
			elif self.direction==6:
				ox = 16
				oy = 8
				dx = 0
				dy = 6*2
			
			ox2=ox+dx
			oy2=oy+dy
			ox3=ox+dx+dx
			oy3=oy+dy+dy
			if self.cnt == self.first:
				enemy_shot(self.x+ox, self.y+oy, 2, 0)
			elif self.cnt == self.first+20:
				enemy_shot(self.x+ox2, self.y+oy2, 2, 0)
			elif self.cnt == self.first+40:
				enemy_shot(self.x+ox3, self.y+oy3, 2, 0)
			elif self.cnt>self.first+40:
				c=self.cnt-self.first
				if c % self.interval==0:
					enemy_shot(self.x+ox, self.y+oy, 2, 0)
				elif c % self.interval==20:
					enemy_shot(self.x+ox2, self.y+oy2, 2, 0)
				elif c % self.interval==40:
					enemy_shot(self.x+ox3, self.y+oy3, 2, 0)
Esempio n. 3
0
	def update(self):
		self.y += 0.8
		if self.cnt >= self.speedup:
			self.y += 1.2
		if gcommon.is_outof_bound(self):
			self.removeFlag = True
		else:
			if self.cnt == self.first:
				enemy_shot(self.x+22,self.y+30,2,0)
				enemy_shot_offset(self.x+10,self.y+18,2,0,-1)
				enemy_shot_offset(self.x+38,self.y+18,2,0,1)
			else:
				c = self.cnt-self.first
				if c % self.interval==0:
					enemy_shot(self.x+22,self.y+30,2,0)
					enemy_shot_offset(self.x+10,self.y+18,2,0,-1)
					enemy_shot_offset(self.x+38,self.y+18,2,0,1)
Esempio n. 4
0
	def update(self):
		self.x += gcommon.direction_map[self.direction][0] * 0.2
		if self.stop_time > 0:
			self.y += gcommon.direction_map[self.direction][1] * 0.2
		
		if gcommon.is_outof_bound(self):
			self.removeFlag = True
		else:
			if self.cnt == self.first:
				enemy_shot(self.x +16, self.y+16, 2, 0)
				self.first = -1
				self.cnt =0
			elif self.cnt == self.interval:
				enemy_shot(self.x +16, self.y+16, 2, 0)
				self.cnt = 0
			
			self.stop_time -=1
Esempio n. 5
0
	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)
Esempio n. 6
0
	def update(self):
		self.x += self.dx
		self.y += self.dy
		if gcommon.is_outof_bound(self):
			self.removeFlag = True
		elif self.cnt < 20 * 60:
			if self.x<0:
				self.x = 0
				self.dx = -self.dx
			elif self.x>240:
				self.x = 240
				self.dx = -self.dx
			
			if self.y<0:
				self.y = 0
				self.dy = -self.dy
			elif self.y>240:
				self.y = 240
				self.dy = -self.dy
Esempio n. 7
0
	def update(self):
		self.x += self.dx
		self.y += 6
		if gcommon.is_outof_bound(self):
			self.removeFlag = True
Esempio n. 8
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))