diff --git a/libs/bg_objects/bg_normal.py b/libs/bg_objects/bg_normal.py index e9d0008..837d867 100644 --- a/libs/bg_objects/bg_normal.py +++ b/libs/bg_objects/bg_normal.py @@ -116,27 +116,11 @@ class BGNormal5(BGNormalBase): def draw(self, tex: TextureWrapper): tex.draw_texture(self.name, 'background') - tex.draw_texture(self.name, 'paper_lamp', frame=9, index=0) - tex.draw_texture(self.name, 'paper_lamp', frame=8, index=1) - tex.draw_texture(self.name, 'paper_lamp', frame=7, index=2) - tex.draw_texture(self.name, 'paper_lamp', frame=6, index=3) - tex.draw_texture(self.name, 'paper_lamp', frame=5, index=4) - tex.draw_texture(self.name, 'paper_lamp', frame=4, index=5) - tex.draw_texture(self.name, 'paper_lamp', frame=3, index=6) - tex.draw_texture(self.name, 'paper_lamp', frame=2, index=7) - tex.draw_texture(self.name, 'paper_lamp', frame=1, index=8) - tex.draw_texture(self.name, 'paper_lamp', frame=0, index=9) + for i in range(10): + tex.draw_texture(self.name, 'paper_lamp', frame=9-i, index=i) - tex.draw_texture(self.name, 'light_overlay', index=0, fade=self.flicker.attribute) - tex.draw_texture(self.name, 'light_overlay', index=1, fade=self.flicker.attribute) - tex.draw_texture(self.name, 'light_overlay', index=2, fade=self.flicker.attribute) - tex.draw_texture(self.name, 'light_overlay', index=3, fade=self.flicker.attribute) - tex.draw_texture(self.name, 'light_overlay', index=4, fade=self.flicker.attribute) - tex.draw_texture(self.name, 'light_overlay', index=5, fade=self.flicker.attribute) - tex.draw_texture(self.name, 'light_overlay', index=6, fade=self.flicker.attribute) - tex.draw_texture(self.name, 'light_overlay', index=7, fade=self.flicker.attribute) - tex.draw_texture(self.name, 'light_overlay', index=8, fade=self.flicker.attribute) - tex.draw_texture(self.name, 'light_overlay', index=9, fade=self.flicker.attribute) + for i in range(10): + tex.draw_texture(self.name, 'light_overlay', index=i, fade=self.flicker.attribute) tex.draw_texture(self.name, 'overlay', fade=0.75) diff --git a/libs/bg_objects/chibi.py b/libs/bg_objects/chibi.py index d9bc1de..43d0446 100644 --- a/libs/bg_objects/chibi.py +++ b/libs/bg_objects/chibi.py @@ -7,25 +7,26 @@ import pyray as ray class Chibi: @staticmethod - def create(index: int, bpm: float, bad: bool): + def create(index: int, bpm: float, bad: bool, tex: TextureWrapper): if bad: - return ChibiBad(index, bpm) - map = [Chibi0, Chibi1, Chibi2, Chibi3, Chibi4, Chibi5, Chibi6, - Chibi7, Chibi8, Chibi9, Chibi10, Chibi11, Chibi12, Chibi13] + return ChibiBad(index, bpm, tex) + map = [Chibi0, BaseChibi, Chibi2, BaseChibi, Chibi4, Chibi5, BaseChibi, + BaseChibi, Chibi8, BaseChibi, BaseChibi, BaseChibi, BaseChibi, Chibi13] selected_obj = map[index] - return selected_obj(index, bpm) + return selected_obj(index, bpm, tex) class BaseChibi: - def __init__(self, index: int, bpm: float): + def __init__(self, index: int, bpm: float, tex: TextureWrapper): self.name = 'chibi_' + str(index) self.bpm = bpm self.hori_move = Animation.create_move(60000 / self.bpm * 5, total_distance=1280) self.hori_move.start() self.vert_move = Animation.create_move(60000 / self.bpm / 2, total_distance=50, reverse_delay=0) self.vert_move.start() - self.keyframes = [0] - - def keyframe(self): + self.index = random.randint(0, len(tex.textures[self.name])-1) + tex_list = tex.textures[self.name][str(self.index)].texture + keyframe_len = tex_list if isinstance(tex_list, list) else [0] + self.keyframes = [i for i in range(len(keyframe_len))] duration = (60000 / self.bpm) / 2 textures = [((duration / len(self.keyframes))*i, (duration / len(self.keyframes))*(i+1), index) for i, index in enumerate(self.keyframes)] self.texture_change = Animation.create_texture_change(duration, textures=textures) @@ -40,9 +41,12 @@ class BaseChibi: if self.texture_change.is_finished: self.texture_change.restart() + def draw(self, tex: TextureWrapper): + tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute, y=-self.vert_move.attribute) + class ChibiBad(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) + def __init__(self, index: int, bpm: float, tex: TextureWrapper): + super().__init__(index, bpm, tex) self.index = random.randint(0, 2) self.keyframes = [3, 4] duration = (60000 / self.bpm) / 2 @@ -69,32 +73,14 @@ class ChibiBad(BaseChibi): tex.draw_texture('chibi_bad', '0', frame=self.texture_change.attribute, x=self.hori_move.attribute, y=self.vert_move.attribute) class Chibi0(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 2) - self.keyframes = [0, 1, 2, 3, 2, 1] - self.keyframe() - def draw(self, tex: TextureWrapper): tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute, y=self.vert_move.attribute) -class Chibi1(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) - self.keyframes = [0, 1, 2, 3, 4, 3, 2, 1] - self.keyframe() - - def draw(self, tex: TextureWrapper): - tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute, y=-self.vert_move.attribute) - class Chibi2(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) + def __init__(self, index: int, bpm: float, tex: TextureWrapper): + super().__init__(index, bpm, tex) self.rotate = Animation.create_move(60000 / self.bpm / 2, total_distance=360, reverse_delay=0) self.rotate.start() - self.keyframe() def update(self, current_time_ms: float): super().update(current_time_ms) @@ -106,116 +92,25 @@ class Chibi2(BaseChibi): origin = ray.Vector2(64, 64) tex.draw_texture(self.name, str(self.index), x=self.hori_move.attribute+origin.x, y=origin.y, origin=origin, rotation=self.rotate.attribute) -class Chibi3(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) - self.keyframes = [i for i in range(8)] - self.keyframe() - - def draw(self, tex: TextureWrapper): - tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute, y=-self.vert_move.attribute) - class Chibi4(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) - self.keyframes = [i for i in range(7)] - self.keyframe() - def draw(self, tex: TextureWrapper): tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute) class Chibi5(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) - self.keyframes = [0, 1, 2, 3, 4, 5, 6, 7, 6, 7, 6, 7, 8] - self.keyframe() - def draw(self, tex: TextureWrapper): tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute) -class Chibi6(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) - self.keyframes = [i for i in range(10)] - self.keyframe() - - def draw(self, tex: TextureWrapper): - tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute, y=-self.vert_move.attribute) - -class Chibi7(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) - self.keyframes = [i for i in range(3) if self.index < 2] - self.keyframe() - - def draw(self, tex: TextureWrapper): - tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute, y=-self.vert_move.attribute) - class Chibi8(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) - self.keyframes = [i for i in range(5)] - self.keyframe() - def draw(self, tex: TextureWrapper): tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute) -class Chibi9(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) - self.keyframes = [i for i in range(7)] - self.keyframe() - - def draw(self, tex: TextureWrapper): - tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute, y=-self.vert_move.attribute) - -class Chibi10(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) - self.keyframes = [i for i in range(7)] - self.keyframe() - - def draw(self, tex: TextureWrapper): - tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute, y=-self.vert_move.attribute) - -class Chibi11(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 1) - self.keyframes = [i for i in range(10)] - self.keyframe() - - def draw(self, tex: TextureWrapper): - tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute, y=-self.vert_move.attribute) - -class Chibi12(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 1) - self.keyframes = [i for i in range(6)] - self.keyframe() - - def draw(self, tex: TextureWrapper): - tex.draw_texture(self.name, str(self.index), frame=self.texture_change.attribute, x=self.hori_move.attribute, y=-self.vert_move.attribute) - class Chibi13(BaseChibi): - def __init__(self, index: int, bpm: float): - super().__init__(index, bpm) - self.index = random.randint(0, 3) - self.keyframes = [i for i in range(7)] + def __init__(self, index: int, bpm: float, tex: TextureWrapper): + super().__init__(index, bpm, tex) duration = (60000 / self.bpm) self.scale = Animation.create_fade(duration, initial_opacity=1.0, final_opacity=0.75, delay=duration, reverse_delay=duration) self.scale.start() self.frame = 0 - self.keyframe() def update(self, current_time_ms: float): super().update(current_time_ms) @@ -246,7 +141,7 @@ class ChibiController: tex.load_zip('background', f'chibi/chibi_bad') def add_chibi(self, bad=False): - self.chibis.add(Chibi.create(self.index, self.bpm, bad)) + self.chibis.add(Chibi.create(self.index, self.bpm, bad, self.tex)) def update(self, current_time_ms: float, bpm: float): self.bpm = bpm diff --git a/libs/bg_objects/dancer.py b/libs/bg_objects/dancer.py index 25f2c49..1a80399 100644 --- a/libs/bg_objects/dancer.py +++ b/libs/bg_objects/dancer.py @@ -7,23 +7,25 @@ class Dancer: @staticmethod def create(tex: TextureWrapper, index: int, bpm: float): - map = [DancerGroup0, DancerGroup0, DancerGroup0, DancerGroup1, DancerGroup2, DancerGroup3, - DancerGroup4, DancerGroup5, DancerGroup6, DancerGroup7, DancerGroup8, DancerGroup9, - DancerGroup10, DancerGroup11, DancerGroup12, DancerGroup13, DancerGroup14, DancerGroup15, - DancerGroup16, DancerGroup17, DancerGroup18] + map = [DancerGroup0, DancerGroup0, DancerGroup0, BaseDancerGroup, BaseDancerGroup, BaseDancerGroup, + BaseDancerGroup, DancerGroupPoof1, DancerGroupPoof1, BaseDancerGroup, BaseDancerGroup, BaseDancerGroup, + DancerGroupPoof2, DancerGroupPoof2, BaseDancerGroup, BaseDancerGroup, DancerGroupPoof2, BaseDancerGroup, + BaseDancerGroup, BaseDancerGroup, BaseDancerGroup] selected_obj = map[index] return selected_obj(tex, index, bpm) class BaseDancer: - def __init__(self, name: str, index: int, bpm: float): + def __init__(self, name: str, index: int, bpm: float, tex: TextureWrapper): self.name = name self.index = index self.bpm = bpm - self.keyframes = [] - self.start_keyframes = [] + tex_list = tex.textures[self.name][str(self.index) + '_loop'].texture + keyframe_len = tex_list if isinstance(tex_list, list) else [0] + self.keyframes = [i for i in range(len(keyframe_len))] + tex_list = tex.textures[self.name][str(self.index) + '_start'].texture + s_keyframe_len = tex_list if isinstance(tex_list, list) else [0] + self.start_keyframes = [i for i in range(len(s_keyframe_len))] self.is_started = False - - def keyframe(self): duration = (60000 / self.bpm) / 2 self.total_duration = duration * len(self.keyframes) self.textures = [(duration*i, duration*(i+1), index) for i, index in enumerate(self.keyframes)] @@ -66,35 +68,9 @@ class BaseDancer: else: tex.draw_texture(self.name, str(self.index) + '_loop', frame=self.texture_change.attribute, x=x) -class Dancer0_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4] - self.keyframes = [0, 1, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 7, 8, 5, 9, 4, 10, 4, 9, 4, 10, 4, 9, 11, 12, 13, 12, 11, 12, 13, 12, 11, 9, 4, 10, 4, 9, 4, 10, 4, 9, 11, 12, 13, 12, 11, 12, 13, 12, 11] - -class Dancer0_1(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4] - self.keyframes = [0, 1, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 7, 8, 5, 9, 4, 10, 4, 9, 4, 10, 4, 9, 11, 12, 13, 12, 11, 12, 13, 12, 11, 9, 4, 10, 4, 9, 4, 10, 4, 9, 11, 12, 13, 12, 11, 12, 13, 12, 11] - -class Dancer0_2(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2] - self.keyframes = [0, 1, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 7, 8, 5, 9, 10, 11, 10, 9, 10, 11, 10, 9, 12, 13, 14, 13, 12, 13, 14, 13, 12, 9, 10, 11, 10, 9, 10, 11, 10, 9, 12, 13, 14, 13, 12, 13, 14, 13, 12] - -class Dancer0_3(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2] - self.keyframes = [0, 1, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 7, 8, 5, 9, 10, 11, 10, 9, 10, 11, 10, 9, 12, 13, 14, 13, 12, 13, 14, 13, 12, 9, 10, 11, 10, 9, 10, 11, 10, 9, 12, 13, 14, 13, 12, 13, 14, 13, 12] - class Dancer0_4(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.keyframes = [0, 1, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 7, 8, 5, 9, 10, 11, 10, 9, 10, 11, 10, 9, 12, 13, 14, 13, 12, 13, 14, 13, 12, 9, 10, 11, 10, 9, 10, 11, 10, 9, 12, 13, 14, 13, 12, 13, 14, 13, 12] - self.start_keyframes = [0, 0, 0, 0, 1, 2, 2, 3, 4, 4, 5, 5, 5, 6, 6] + def __init__(self, name: str, index: int, bpm: float, tex: TextureWrapper): + super().__init__(name, index, bpm, tex) duration = (60000 / bpm) / 2 self.bounce_up = Animation.create_move(duration, total_distance=20, ease_out='quadratic', delay=duration*2) self.bounce_down = Animation.create_move(duration, total_distance=20, ease_in='quadratic', delay=duration*2+self.bounce_up.duration) @@ -117,42 +93,16 @@ class Dancer0_4(BaseDancer): tex.draw_texture(self.name, '4_start', frame=self.s_texture_change.attribute, x=x, y=-self.s_bounce_up.attribute + self.s_bounce_down.attribute) else: if 0 <= self.texture_change.attribute <= 3: - tex.draw_texture(self.name, '4_loop', frame=15, x=x, y=-self.bounce_up.attribute + self.bounce_down.attribute) + tex.draw_texture(self.name, '4_loop', frame=54, x=x, y=-self.bounce_up.attribute + self.bounce_down.attribute) elif 5 <= self.texture_change.attribute <= 8: - tex.draw_texture(self.name, '4_loop', frame=17, x=x, y=-self.bounce_up.attribute + self.bounce_down.attribute) + tex.draw_texture(self.name, '4_loop', frame=56, x=x, y=-self.bounce_up.attribute + self.bounce_down.attribute) elif self.texture_change.attribute == 4: - tex.draw_texture(self.name, '4_loop', frame=16, x=x, y=-self.bounce_up.attribute + self.bounce_down.attribute) + tex.draw_texture(self.name, '4_loop', frame=55, x=x, y=-self.bounce_up.attribute + self.bounce_down.attribute) tex.draw_texture(self.name, '4_loop', frame=self.texture_change.attribute, x=x) -class Dancer1_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11] - self.keyframes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] - -class Dancer2_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11] - self.keyframes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - -class Dancer3_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8] - self.keyframes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] - -class Dancer4_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8] - self.keyframes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] - -class Dancer5_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4] - self.keyframes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] +class DancerPoof(BaseDancer): + def __init__(self, name: str, index: int, bpm: float, tex: TextureWrapper): + super().__init__(name, index, bpm, tex) duration = (60000 / self.bpm) poof_keyframes = [((duration / 7)*i, (duration / 7)*(i+1), i) for i in range(7)] self.poof_texture_change = Animation.create_texture_change(duration, textures=poof_keyframes, delay=250) @@ -167,153 +117,39 @@ class Dancer5_0(BaseDancer): if not self.poof_texture_change.is_finished: tex.draw_texture(self.name, 'poof', x=x, frame=self.poof_texture_change.attribute) -class Dancer6_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4] - self.keyframes = [0, 1, 2, 3, 2, 1, 0, 4, 5, 6, 5, 4, 0, 1, 2, 3, 2, 1, 2, 3, 0, 4, 5, 6, 5, 4, 5, 6, 0] - duration = (60000 / self.bpm) - poof_keyframes = [((duration / 7)*i, (duration / 7)*(i+1), i) for i in range(7)] - self.poof_texture_change = Animation.create_texture_change(duration, textures=poof_keyframes, delay=250) - self.poof_texture_change.start() - - def update(self, current_time_ms: float, bpm: float): - super().update(current_time_ms, bpm) - self.poof_texture_change.update(current_time_ms) - +class DancerPoof2(DancerPoof): def draw(self, tex: TextureWrapper, x: int): - super().draw(tex, x) - if not self.poof_texture_change.is_finished: - tex.draw_texture(self.name, 'poof', x=x, frame=self.poof_texture_change.attribute) - -class Dancer7_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6] - self.keyframes = [0, 1, 0, 1, 0, 2, 3, 4, 0, 1, 0, 1, 0, 5, 6, 7] - -class Dancer8_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 1, 1, 2, 2, 3, 3] - self.keyframes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] - -class Dancer9_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 1, 1, 2, 2, 3, 3] - self.keyframes = [i for i in range(21)] - -class Dancer10_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5] - self.keyframes = [0, 1, 2, 3, 4, 5, 4, 6, 7, 8] - duration = (60000 / self.bpm) - poof_keyframes = [((duration / 7)*i, (duration / 7)*(i+1), i) for i in range(7)] - self.poof_texture_change = Animation.create_texture_change(duration, textures=poof_keyframes, delay=250) - self.poof_texture_change.start() - - def update(self, current_time_ms: float, bpm: float): - super().update(current_time_ms, bpm) - self.poof_texture_change.update(current_time_ms) - - def draw(self, tex: TextureWrapper, x: int): - super().draw(tex, x) + if not self.is_started: + return + if not self.s_texture_change.is_finished: + tex.draw_texture(self.name, str(self.index) + '_start', frame=self.s_texture_change.attribute, x=x, y=-self.s_bounce_up.attribute + self.s_bounce_down.attribute) + else: + tex.draw_texture(self.name, str(self.index) + '_loop', frame=self.texture_change.attribute, x=x) if not self.poof_texture_change.is_finished: tex.draw_texture(self.name, str(self.index) + '_poof', x=x, frame=self.poof_texture_change.attribute) -class Dancer11_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5] - self.keyframes = [0, 1, 2, 3, 4, 5, 6, 5, 6, 4, 7, 8, 9, 10, 11, 3, 12, 13] - duration = (60000 / self.bpm) - poof_keyframes = [((duration / 7)*i, (duration / 7)*(i+1), i) for i in range(7)] - self.poof_texture_change = Animation.create_texture_change(duration, textures=poof_keyframes, delay=250) - self.poof_texture_change.start() - - def update(self, current_time_ms: float, bpm: float): - super().update(current_time_ms, bpm) - self.poof_texture_change.update(current_time_ms) - - def draw(self, tex: TextureWrapper, x: int): - super().draw(tex, x) - if not self.poof_texture_change.is_finished: - tex.draw_texture(self.name, str(self.index) + '_poof', x=x, frame=self.poof_texture_change.attribute) - -class Dancer12_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 1, 2, 3] - self.keyframes = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, - 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 9, 10, 11, 12, 13, 7, - 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, - 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15] - -class Dancer13_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 1, 2, 3, 4, 5] - self.keyframes = [i for i in range(20)] - -class Dancer14_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0] - self.keyframes = [i for i in range(19)] - duration = (60000 / self.bpm) - poof_keyframes = [((duration / 7)*i, (duration / 7)*(i+1), i) for i in range(7)] - self.poof_texture_change = Animation.create_texture_change(duration, textures=poof_keyframes, delay=250) - self.poof_texture_change.start() - - def update(self, current_time_ms: float, bpm: float): - super().update(current_time_ms, bpm) - self.poof_texture_change.update(current_time_ms) - - def draw(self, tex: TextureWrapper, x: int): - super().draw(tex, x) - if not self.poof_texture_change.is_finished: - tex.draw_texture(self.name, str(self.index) + '_poof', x=x, frame=self.poof_texture_change.attribute) - -class Dancer15_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 1, 2, 3, 4, 5] - self.keyframes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 9, 10, 11, 12, 13, 14, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 20, 21, 22, 23, 24] - -class Dancer16_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 1, 2, 3] - self.keyframes = [0, 1, 2, 3, 0, 1, 2, 3, - 4, 5, 6, 7, 8, 6, 7, 8, 9] - -class Dancer17_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 1, 2, 3] - self.keyframes = [i for i in range(14)] - -class Dancer18_0(BaseDancer): - def __init__(self, name: str, index: int, bpm: float): - super().__init__(name, index, bpm) - self.start_keyframes = [0, 1, 2, 3, 4, 5] - self.keyframes = [i for i in range(44)] - class BaseDancerGroup(): def __init__(self, tex: TextureWrapper, index: int, bpm: float): self.name = 'dancer_' + str(index) self.active_count = 0 tex.load_zip('background', f'dancer/{self.name}') - self.dancers = [] - # Define spawn positions: center (2), left (1), right (3), far left (0), far right (4) + # center (2), left (1), right (3), far left (0), far right (4) self.spawn_positions = [2, 1, 3, 0, 4] self.active_dancers = [None] * 5 + dancer_classes = [BaseDancer] + tex_set = set() + tex_dict = tex.textures['dancer_' + str(index)] + for key in tex_dict.keys(): + if key[0].isdigit(): + tex_set.add(int(key[0])) + self.dancers = [] + for i in range(5): + DancerClass = random.choice(dancer_classes) + dancer = DancerClass(self.name, i % len(tex_set), bpm, tex) + self.dancers.append(dancer) + + random.shuffle(self.dancers) + self.add_dancer() def add_dancer(self): if self.active_count < len(self.dancers) and self.active_count < len(self.spawn_positions): @@ -334,299 +170,60 @@ class BaseDancerGroup(): class DancerGroup0(BaseDancerGroup): def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - self.dancers = [Dancer0_0(self.name, 0, bpm), Dancer0_1(self.name, 1, bpm), - Dancer0_2(self.name, 2, bpm), Dancer0_3(self.name, 3, bpm), - Dancer0_4(self.name, 4, bpm)] + self.name = 'dancer_' + str(index) + self.active_count = 0 + tex.load_zip('background', f'dancer/{self.name}') + # center (2), left (1), right (3), far left (0), far right (4) + self.spawn_positions = [2, 1, 3, 0, 4] + self.active_dancers = [None] * 5 + self.dancers = [BaseDancer(self.name, 0, bpm, tex), BaseDancer(self.name, 1, bpm, tex), + BaseDancer(self.name, 2, bpm, tex), BaseDancer(self.name, 3, bpm, tex), + Dancer0_4(self.name, 4, bpm, tex)] random.shuffle(self.dancers) - for dancer in self.dancers: - dancer.keyframe() self.add_dancer() -class DancerGroup1(BaseDancerGroup): +class DancerGroupPoof1(BaseDancerGroup): def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer1_0] + self.name = 'dancer_' + str(index) + self.active_count = 0 + tex.load_zip('background', f'dancer/{self.name}') + # center (2), left (1), right (3), far left (0), far right (4) + self.spawn_positions = [2, 1, 3, 0, 4] + self.active_dancers = [None] * 5 + dancer_classes = [DancerPoof] + tex_set = set() + tex_dict = tex.textures['dancer_' + str(index)] + for key in tex_dict.keys(): + if key[0].isdigit(): + tex_set.add(int(key[0])) self.dancers = [] for i in range(5): DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 3, bpm) + dancer = DancerClass(self.name, i % len(tex_set), bpm, tex) self.dancers.append(dancer) random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() self.add_dancer() -class DancerGroup2(BaseDancerGroup): +class DancerGroupPoof2(BaseDancerGroup): def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer2_0] + self.name = 'dancer_' + str(index) + self.active_count = 0 + tex.load_zip('background', f'dancer/{self.name}') + # center (2), left (1), right (3), far left (0), far right (4) + self.spawn_positions = [2, 1, 3, 0, 4] + self.active_dancers = [None] * 5 + dancer_classes = [DancerPoof2] + tex_set = set() + tex_dict = tex.textures['dancer_' + str(index)] + for key in tex_dict.keys(): + if key[0].isdigit(): + tex_set.add(int(key[0])) self.dancers = [] for i in range(5): DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 3, bpm) + dancer = DancerClass(self.name, i % len(tex_set), bpm, tex) self.dancers.append(dancer) random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup3(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer3_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 4, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup4(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer4_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 4, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup5(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer5_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 2, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup6(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer6_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 2, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup7(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer7_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 4, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup8(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer8_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 4, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup9(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer9_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 3, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup10(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer10_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 4, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup11(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer11_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 3, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup12(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer12_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 3, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup13(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer13_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 3, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup14(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer14_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 4, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup15(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer15_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 3, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup16(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer16_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 4, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup17(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer17_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 4, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() - self.add_dancer() - -class DancerGroup18(BaseDancerGroup): - def __init__(self, tex: TextureWrapper, index: int, bpm: float): - super().__init__(tex, index, bpm) - dancer_classes = [Dancer18_0] - self.dancers = [] - for i in range(5): - DancerClass = random.choice(dancer_classes) - dancer = DancerClass(self.name, i % 2, bpm) - self.dancers.append(dancer) - - random.shuffle(self.dancers) - - for dancer in self.dancers: - dancer.keyframe() self.add_dancer()