diff --git a/libs/background.py b/libs/background.py index d2f626d..c694250 100644 --- a/libs/background.py +++ b/libs/background.py @@ -17,7 +17,7 @@ class Background: self.bg_fever = BGFever.create(self.tex_wrapper, random.randint(0, 3)) self.footer = Footer(self.tex_wrapper, random.randint(0, 2)) self.fever = Fever.create(self.tex_wrapper, random.randint(0, 3), bpm) - self.dancer = Dancer.create(self.tex_wrapper, 8, bpm) + self.dancer = Dancer.create(self.tex_wrapper, random.randint(0, 20), bpm) self.is_clear = False self.is_rainbow = False self.last_milestone = 0 diff --git a/libs/bg_objects/dancer.py b/libs/bg_objects/dancer.py index fb6a802..25f2c49 100644 --- a/libs/bg_objects/dancer.py +++ b/libs/bg_objects/dancer.py @@ -7,7 +7,10 @@ class Dancer: @staticmethod def create(tex: TextureWrapper, index: int, bpm: float): - map = [DancerGroup0, DancerGroup0, DancerGroup0, DancerGroup1, DancerGroup2, DancerGroup3, DancerGroup4, DancerGroup5, DancerGroup6] + map = [DancerGroup0, DancerGroup0, DancerGroup0, DancerGroup1, DancerGroup2, DancerGroup3, + DancerGroup4, DancerGroup5, DancerGroup6, DancerGroup7, DancerGroup8, DancerGroup9, + DancerGroup10, DancerGroup11, DancerGroup12, DancerGroup13, DancerGroup14, DancerGroup15, + DancerGroup16, DancerGroup17, DancerGroup18] selected_obj = map[index] return selected_obj(tex, index, bpm) @@ -127,84 +130,24 @@ class Dancer1_0(BaseDancer): 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 Dancer1_1(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 Dancer1_2(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 Dancer2_1(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 Dancer2_2(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 Dancer3_1(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 Dancer3_2(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 Dancer3_3(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 Dancer4_1(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 Dancer4_2(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 Dancer4_3(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) @@ -243,6 +186,125 @@ class Dancer6_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 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.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) @@ -284,7 +346,7 @@ class DancerGroup0(BaseDancerGroup): class DancerGroup1(BaseDancerGroup): def __init__(self, tex: TextureWrapper, index: int, bpm: float): super().__init__(tex, index, bpm) - dancer_classes = [Dancer1_0, Dancer1_1, Dancer1_2] + dancer_classes = [Dancer1_0] self.dancers = [] for i in range(5): DancerClass = random.choice(dancer_classes) @@ -300,7 +362,7 @@ class DancerGroup1(BaseDancerGroup): class DancerGroup2(BaseDancerGroup): def __init__(self, tex: TextureWrapper, index: int, bpm: float): super().__init__(tex, index, bpm) - dancer_classes = [Dancer2_0, Dancer2_1, Dancer2_2] + dancer_classes = [Dancer2_0] self.dancers = [] for i in range(5): DancerClass = random.choice(dancer_classes) @@ -316,7 +378,7 @@ class DancerGroup2(BaseDancerGroup): class DancerGroup3(BaseDancerGroup): def __init__(self, tex: TextureWrapper, index: int, bpm: float): super().__init__(tex, index, bpm) - dancer_classes = [Dancer3_0, Dancer3_1, Dancer3_2, Dancer3_3] + dancer_classes = [Dancer3_0] self.dancers = [] for i in range(5): DancerClass = random.choice(dancer_classes) @@ -332,7 +394,7 @@ class DancerGroup3(BaseDancerGroup): class DancerGroup4(BaseDancerGroup): def __init__(self, tex: TextureWrapper, index: int, bpm: float): super().__init__(tex, index, bpm) - dancer_classes = [Dancer4_0, Dancer4_1, Dancer4_2, Dancer4_3] + dancer_classes = [Dancer4_0] self.dancers = [] for i in range(5): DancerClass = random.choice(dancer_classes) @@ -376,3 +438,195 @@ class DancerGroup6(BaseDancerGroup): 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()