def fire_100(self, child): time = child.timer speed = 250*MEASURE_UNIT delta_time = 5 for i in range(16): temp_list = [] dt = i*delta_time for j in range(20): b = barrage.Barrage(child, ['texturedball', '3']) b.speed = speed b.position[0] = child.position[0] + cos(math.pi/2 + math.pi*i/15)*200 b.position[1] = child.position[1] + sin(math.pi/2 + math.pi*i/15)*200 b.correct_start_position = False b.velocity = vector.objVector(speed, 0) b.velocity.angle = j*(360/16) temp_list.append(b) for j in range(20): b = barrage.Barrage(child, ['texturedball', '4']) b.speed = speed b.velocity = vector.objVector(speed, 0) b.position[0] = child.position[0] + cos(math.pi/2 - math.pi*i/15)*200 b.position[1] = child.position[1] + sin(math.pi/2 - math.pi*i/15)*200 b.correct_start_position = False b.velocity.angle = j*(360/16) temp_list.append(b) try: child.fire_pattern_temp[time + dt].append(b) except: child.fire_pattern_temp[time + dt] = [] child.fire_pattern_temp[time + dt] = child.fire_pattern_temp[time + dt] + temp_list
def defualt_danmaku_pattern_004(child, barrage_type=['texturedball', '6'], count1=5, count2=18, delta_time=10, speed=250 * MEASURE_UNIT): '''circular scattering ''' time = child.timer for i in range(count1): dt = i * delta_time temp_list = [] for j in range(count2): b = barrage.Barrage(child, barrage_type) b.speed = speed b.aim = True b.setup_angle = j * (360 / count2) temp_list.append(b) try: child.fire_pattern_temp[time + dt].append(b) except: child.fire_pattern_temp[time + dt] = [] child.fire_pattern_temp[ time + dt] = child.fire_pattern_temp[time + dt] + temp_list
def fire_003_00(self, child): # 三条通常狙:滚球 time = child.timer barrage_type = ['midball', '2'] count1 = 3 count2 = 3 delta_time = 0 angle = 30 speed = 200*MEASURE_UNIT delta_speed = 25*MEASURE_UNIT for i in range(count1): for j in range(count2): dt = j*delta_time b = barrage.Barrage(child, barrage_type) b.aim = False b.velocity = vector.objVector(child.parent.player.position - b.parent.position) b.velocity.norm = speed + j*delta_speed if count1%2 != 0: mid = int(count1/2) b.velocity.angle += angle*(i - mid) else: mid = count1/2 + 0.5 b.velocity.angle += angle*(i - mid) try: child.fire_pattern_temp[time + dt].append(b) except: child.fire_pattern_temp[time + dt] = [] child.fire_pattern_temp[time + dt].append(b)
def fire_akui(self, barrage_type, direction=1): time = self.timer anchor_position = vector.objVector(-100, 0) anchor_cnt = 15 b_cnt1 = 10 b_cnt2 = 5 b_speed1 = 100 * MEASURE_UNIT b_speed2 = 150 * MEASURE_UNIT dt = 1 da = 180 / anchor_cnt for i in range(anchor_cnt): angle = (da * i + 90) * direction total_dt = i * dt anchor_position.angle = angle temp_list = [] for j in range(b_cnt1): b = barrage.Barrage(self, barrage_type) b.position = anchor_position + self.position b.velocity = vector.objVector(b_speed1, 0) b.velocity.angle = (360 / b_cnt1) * j - 90 + da * i b.correct_start_position = False temp_list.append(b) for k in range(b_cnt2): b = barrage.Barrage(self, barrage_type) b.position = anchor_position + self.position b.velocity = vector.objVector(b_speed2, 0) b.velocity.angle = (180 / b_cnt2) * j - 90 + da * i b.correct_start_position = False temp_list.append(b) try: self.fire_pattern_temp[time + total_dt] = self.fire_pattern_temp[ time + total_dt] + temp_list except: self.fire_pattern_temp[time + total_dt] = [] self.fire_pattern_temp[time + total_dt] = self.fire_pattern_temp[ time + total_dt] + temp_list
def defualt_danmaku_pattern_002(child, barrage_type=['square', '1'], count=5, delta_time=5, speed=250 * MEASURE_UNIT): time = child.timer for i in range(count): dt = i * delta_time b = barrage.Barrage(child, barrage_type) b.aim = True b.speed = speed try: child.fire_pattern_temp[time + dt].append(b) except: child.fire_pattern_temp[time + dt] = [] child.fire_pattern_temp[time + dt].append(b)
def defualt_danmaku_pattern_001(child, barrage_type=['diamond', '4'], count=5, delta_time=5, speed=250 * MEASURE_UNIT): time = child.timer for i in range(count): dt = i * delta_time b = barrage.Barrage(child, barrage_type) b.velocity = vector.objVector(child.parent.player.position - b.parent.position) b.velocity.norm = speed try: child.fire_pattern_temp[time + dt].append(b) except: child.fire_pattern_temp[time + dt] = [] child.fire_pattern_temp[time + dt].append(b)
def fire_006(self, child, direction=1): time = child.timer barrage_type = ['dart', '2'] count = 20 delta_t = 3 delta_a = 2 speed = 150*MEASURE_UNIT for i in range(count): aim = child.parent.player.position - child.position b = barrage.Barrage(child, barrage_type) b.velocity = vector.objVector(speed, 0) b.velocity.angle = aim.angle + random.randint(0, 60) - 30 try: child.fire_pattern_temp[time+ delta_t*i].append(b) except: child.fire_pattern_temp[time+ delta_t*i] = [] child.fire_pattern_temp[time+ delta_t*i].append(b)
def fire_005(self, child, direction=1): time = child.timer barrage_type = ['barrier', '4'] count = 5 delta_t = 3 delta_a = 2 speed = 200*MEASURE_UNIT for i in range(count): b = barrage.Barrage(child, barrage_type) aim = child.parent.player.position - b.parent.position b.velocity = vector.objVector(speed, 0) b.velocity.angle = delta_a*i*direction + aim.angle try: child.fire_pattern_temp[time+ delta_t*i].append(b) except: child.fire_pattern_temp[time+ delta_t*i] = [] child.fire_pattern_temp[time+ delta_t*i].append(b)
def fire_tornado(self, barrage_type, anchor_point_cnt=3, anchor_point_da=15): time = self.timer anchor_point_dt = 5 anchor_point_dd = 3 d_from_boss = 120 b_cnt1 = 2 b_cnt2 = 2 b_speed = 140 * MEASURE_UNIT b_ds = 15 * MEASURE_UNIT for anchor in range(anchor_point_cnt): anchor_position = vector.objVector(d_from_boss, 0) anchor_position.angle = anchor * (360 / anchor_point_cnt) total_dt = 0 for k in range(int(d_from_boss / anchor_point_dd)): total_dt += anchor_point_dt anchor_position.norm -= anchor_point_dd anchor_position.angle += anchor_point_da anchor_n_position = anchor_position.copy() anchor_n_position.norm -= anchor_point_dd anchor_n_position.angle += anchor_point_da dp = anchor_position - anchor_n_position anchor_r_position = anchor_position + self.position for i in range(b_cnt1): for j in range(b_cnt2): b = barrage.Barrage(self, barrage_type) b.correct_start_position = False b.position = anchor_r_position b.velocity = vector.objVector( b_speed + b_ds * i * (j + 1), 0) b.velocity.angle = dp.angle + 20 * j try: self.fire_pattern_temp[time + total_dt].append(b) except: self.fire_pattern_temp[time + total_dt] = [] self.fire_pattern_temp[time + total_dt].append(b)
def custum_fire(self, child): # 早苗🌟弹 time = child.timer distance = 6 radius = 100 # 半径 #start sx = child.position[0] sy = child.position[1] - radius sangle = pi / 5 / 2 + pi / 2 delta_time = 0 sst = 0 while sst <= 4: i = 0 while True: delta_time += 0.5 sx += cos(sangle) * distance sy += sin(sangle) * distance if (sx - child.position[0])**2 + ( sy - child.position[1])**2 > radius * radius: sst += 1 sangle -= (pi - pi / 5) break for j in range(5): new = barrage.Barrage(child, ['ball', str(j + 1)]) new.position = vector.objVector(sx, sy) new.correct_start_position = False new.phase_list = [self.custom_fire_update] new.custom_messages = { "start_angle": math.degrees(pi - 2 * pi / 5 * j), "base_angle": math.degrees(sangle - pi + pi / 20 * i), "delay": int(delta_time) } try: child.fire_pattern_temp[time + int(delta_time)].append(new) except: child.fire_pattern_temp[time + int(delta_time)] = [] child.fire_pattern_temp[time + int(delta_time)].append(new) i += 1
def defualt_danmaku_pattern_006(child, end_point=vector.objVector(0, 0), barrage_type=['laser', '1']): time = child.timer distance = end_point - child.position angle = distance.angle center = distance / 2 b = barrage.Barrage(child, barrage_type) b.position = child.position + center b.phase_list = [barrage.Barrage.motion_laser] b.correct_start_position = False b.height = int(distance.norm) child.fire_group.add(b) try: child.fire_pattern_temp[time].append(b) except: child.fire_pattern_temp[time] = [] child.fire_pattern_temp[time].append(b)
def defualt_danmaku_pattern_005(child, barrage_type=['diamond', '1'], count=50, angle=90, delta_time=4, speed=250 * MEASURE_UNIT, ds=-2 * MEASURE_UNIT): '''circular scattering ''' time = child.timer for i in range(count): dt = i * delta_time b = barrage.Barrage(child, barrage_type) b.speed = speed + ds * i b.velocity = vector.objVector(0, b.speed) b.setup_angle = random.randrange(int(-1 * angle / 2), angle / 2) try: child.fire_pattern_temp[time + dt].append(b) except: child.fire_pattern_temp[time + dt] = [] child.fire_pattern_temp[time + dt].append(b)
def fire_004(self, child): time = child.timer barrage_type = ['midball', '1'] count1 = 2 count2 = 4 delta_time = 0 speed = 200*MEASURE_UNIT delta_speed = 25*MEASURE_UNIT for i in range(count1): if i: angle = 170 else: angle = -170 for j in range(count2): b = barrage.Barrage(child, barrage_type) b.velocity = vector.objVector(speed + delta_speed*j, 0) b.velocity.angle = angle try: child.fire_pattern_temp[time+1].append(b) except: child.fire_pattern_temp[time+1] = [] child.fire_pattern_temp[time+1].append(b)