mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 03:30:13 +01:00
added player 2 skin
This commit is contained in:
@@ -9,12 +9,12 @@ from libs.utils import load_all_textures_from_zip
|
||||
|
||||
|
||||
class Background:
|
||||
def __init__(self, screen_width: int, screen_height: int):
|
||||
def __init__(self, screen_width: int, screen_height: int, player_num: int):
|
||||
self.screen_width = screen_width
|
||||
self.screen_height = screen_height
|
||||
self.tex_wrapper = TextureWrapper()
|
||||
self.tex_wrapper.load_animations('background')
|
||||
self.donbg = DonBG.create(self.tex_wrapper, self.screen_width, self.screen_height, random.randint(1, 6), 1)
|
||||
self.donbg = DonBG.create(self.tex_wrapper, self.screen_width, self.screen_height, random.randint(0, 5), player_num)
|
||||
self.bg_normal = BGNormal.create(self.screen_width, self.screen_height, random.randint(1, 5))
|
||||
self.bg_fever = BGFever.create(self.screen_width, self.screen_height, 4)
|
||||
self.footer = Footer(self.tex_wrapper, random.randint(0, 2))
|
||||
@@ -31,18 +31,16 @@ class Background:
|
||||
if self.is_clear:
|
||||
self.bg_fever.draw()
|
||||
self.footer.draw(self.tex_wrapper)
|
||||
self.donbg.draw()
|
||||
self.donbg.draw(self.tex_wrapper)
|
||||
|
||||
def unload(self):
|
||||
self.donbg.unload()
|
||||
self.bg_normal.unload()
|
||||
self.bg_fever.unload()
|
||||
self.tex_wrapper.unload_textures()
|
||||
|
||||
class DonBG:
|
||||
|
||||
@staticmethod
|
||||
def create(tex: TextureWrapper, screen_width: int, screen_height: int, index: int, player_num: int):
|
||||
map = [None, DonBG1, DonBG2, DonBG3, DonBG4, DonBG5, DonBG6]
|
||||
map = [DonBG1, DonBG2, DonBG3, DonBG4, DonBG5, DonBG6]
|
||||
selected_obj = map[index]
|
||||
return selected_obj(tex, index, screen_width, screen_height, player_num)
|
||||
|
||||
@@ -50,93 +48,73 @@ class DonBGBase:
|
||||
def __init__(self, tex: TextureWrapper, index: int, screen_width: int, screen_height: int, player_num: int):
|
||||
self.screen_width = screen_width
|
||||
self.screen_height = screen_height
|
||||
#tex.load_zip('background', f'donbg/{index}_{player_num}')
|
||||
self.player_num = player_num
|
||||
self.name = 'donbg_a_' + str(index).zfill(2)
|
||||
self.textures = (load_all_textures_from_zip(Path(f'Graphics/lumendata/enso_original/{self.name}_{self.player_num}p.zip')))
|
||||
self.move = Animation.create_move(3000, start_position=0, total_distance=-self.textures[self.name + f'_{self.player_num}p'][0].width)
|
||||
self.name = f'{index}_{player_num}'
|
||||
tex.load_zip('background', f'donbg/{self.name}')
|
||||
self.move = tex.get_animation(0)
|
||||
self.move.start()
|
||||
self.is_clear = False
|
||||
self.clear_fade = None
|
||||
self.clear_fade = tex.get_animation(1)
|
||||
|
||||
def update(self, current_time_ms: float, is_clear: bool):
|
||||
if not self.is_clear and is_clear:
|
||||
self.clear_fade = Animation.create_fade(150, initial_opacity=0.0, final_opacity=1.0)
|
||||
self.clear_fade.start()
|
||||
self.is_clear = is_clear
|
||||
self.move.update(current_time_ms)
|
||||
if self.clear_fade is not None:
|
||||
self.clear_fade.update(current_time_ms)
|
||||
self.clear_fade.update(current_time_ms)
|
||||
if self.move.is_finished:
|
||||
self.move.restart()
|
||||
|
||||
def unload(self):
|
||||
for texture_group in self.textures:
|
||||
for texture in self.textures[texture_group]:
|
||||
ray.unload_texture(texture)
|
||||
|
||||
class DonBG1(DonBGBase):
|
||||
def __init__(self, tex: TextureWrapper, index: int, screen_width: int, screen_height: int, player_num: int):
|
||||
super().__init__(tex, index, screen_width, screen_height, player_num)
|
||||
self.overlay_move = Animation.create_move(1000, start_position=0, total_distance=20, reverse_delay=0)
|
||||
self.overlay_move = tex.get_animation(2)
|
||||
self.overlay_move.start()
|
||||
def update(self, current_time_ms: float, is_clear: bool):
|
||||
super().update(current_time_ms, is_clear)
|
||||
self.overlay_move.update(current_time_ms)
|
||||
if self.overlay_move.is_finished:
|
||||
self.overlay_move.restart()
|
||||
def draw(self):
|
||||
self._draw_textures(0, ray.WHITE)
|
||||
if self.is_clear and self.clear_fade is not None:
|
||||
self._draw_textures(3, ray.fade(ray.WHITE, self.clear_fade.attribute))
|
||||
def _draw_textures(self, texture_index: int, color: ray.Color):
|
||||
top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index]
|
||||
for i in range(0, self.screen_width + top_texture.width, top_texture.width):
|
||||
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
|
||||
|
||||
wave_texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
|
||||
for i in range(0, self.screen_width + (wave_texture.width+80), wave_texture.width+80):
|
||||
ray.draw_texture(wave_texture, i + int(self.move.attribute * ((wave_texture.width+80)/top_texture.width)) + 100, int(self.overlay_move.attribute), color)
|
||||
|
||||
texture = self.textures[self.name + f'_{self.player_num}p'][2 + texture_index]
|
||||
for i in range(0, self.screen_width + texture.width + texture.width*5, texture.width):
|
||||
ray.draw_texture(texture, i + int(self.move.attribute * (texture.width/top_texture.width)*3), int(self.overlay_move.attribute) + 105, color)
|
||||
def draw(self, tex: TextureWrapper):
|
||||
self._draw_textures(tex, 1.0)
|
||||
if self.is_clear:
|
||||
self._draw_textures(tex, self.clear_fade.attribute)
|
||||
def _draw_textures(self, tex: TextureWrapper, fade: float):
|
||||
for i in range(5):
|
||||
tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute)
|
||||
for i in range(6):
|
||||
tex.draw_texture(self.name, 'overlay', frame=self.is_clear, fade=fade, x=(i*347)+self.move.attribute*(347/328), y=self.overlay_move.attribute)
|
||||
for i in range(30):
|
||||
tex.draw_texture(self.name, 'footer', frame=self.is_clear, fade=fade, x=(i*56)+self.move.attribute*((56/328)*3), y=self.overlay_move.attribute)
|
||||
|
||||
class DonBG2(DonBGBase):
|
||||
def __init__(self, tex: TextureWrapper, index: int, screen_width: int, screen_height: int, player_num: int):
|
||||
super().__init__(tex, index, screen_width, screen_height, player_num)
|
||||
self.overlay_move = Animation.create_move(1500, start_position=0, total_distance=20, reverse_delay=0)
|
||||
self.overlay_move = tex.get_animation(3)
|
||||
self.overlay_move.start()
|
||||
def update(self, current_time_ms: float, is_clear: bool):
|
||||
super().update(current_time_ms, is_clear)
|
||||
self.overlay_move.update(current_time_ms)
|
||||
if self.overlay_move.is_finished:
|
||||
self.overlay_move.restart()
|
||||
def draw(self):
|
||||
self._draw_textures(0, ray.WHITE)
|
||||
if self.is_clear and self.clear_fade is not None:
|
||||
self._draw_textures(2, ray.fade(ray.WHITE, self.clear_fade.attribute))
|
||||
def _draw_textures(self, texture_index: int, color: ray.Color):
|
||||
top_texture = self.textures[self.name + f'_{self.player_num}p'][texture_index]
|
||||
for i in range(0, self.screen_width + top_texture.width, top_texture.width):
|
||||
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
|
||||
|
||||
texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
|
||||
for i in range(0, self.screen_width + texture.width, texture.width):
|
||||
ray.draw_texture(texture, i + int(self.move.attribute), int(self.overlay_move.attribute) - 25, color)
|
||||
def draw(self, tex: TextureWrapper):
|
||||
self._draw_textures(tex, 1.0)
|
||||
if self.is_clear:
|
||||
self._draw_textures(tex, self.clear_fade.attribute)
|
||||
def _draw_textures(self, tex: TextureWrapper, fade: float):
|
||||
for i in range(5):
|
||||
tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute)
|
||||
tex.draw_texture(self.name, 'overlay', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute, y=self.overlay_move.attribute)
|
||||
|
||||
class DonBG3(DonBGBase):
|
||||
def __init__(self, tex: TextureWrapper, index: int, screen_width: int, screen_height: int, player_num: int):
|
||||
super().__init__(tex, index, screen_width, screen_height, player_num)
|
||||
duration = 266
|
||||
bounce_distance = 40
|
||||
self.bounce_up = Animation.create_move(duration, total_distance=-bounce_distance, ease_out='quadratic')
|
||||
self.bounce_up = tex.get_animation(4)
|
||||
self.bounce_down = tex.get_animation(5)
|
||||
self.overlay_move = tex.get_animation(6)
|
||||
self.overlay_move_2 = tex.get_animation(7)
|
||||
self.bounce_up.start()
|
||||
self.bounce_down = Animation.create_move(duration, total_distance=-bounce_distance, ease_in='quadratic', delay=self.bounce_up.duration)
|
||||
self.bounce_down.start()
|
||||
self.overlay_move = Animation.create_move(duration*3, total_distance=20, reverse_delay=0, ease_in='quadratic', ease_out='quadratic', delay=self.bounce_up.duration+self.bounce_down.duration)
|
||||
self.overlay_move.start()
|
||||
self.overlay_move_2 = Animation.create_move(duration*3, total_distance=20, reverse_delay=0, ease_in='quadratic', ease_out='quadratic', delay=self.bounce_up.duration+self.bounce_down.duration+self.overlay_move.duration)
|
||||
self.overlay_move_2.start()
|
||||
|
||||
def update(self, current_time_ms: float, is_clear: bool):
|
||||
@@ -151,53 +129,46 @@ class DonBG3(DonBGBase):
|
||||
self.overlay_move.restart()
|
||||
self.overlay_move_2.restart()
|
||||
|
||||
def draw(self):
|
||||
self._draw_textures(0, ray.WHITE)
|
||||
if self.is_clear and self.clear_fade is not None:
|
||||
self._draw_textures(2, ray.fade(ray.WHITE, self.clear_fade.attribute))
|
||||
def draw(self, tex: TextureWrapper):
|
||||
self._draw_textures(tex, 1.0)
|
||||
if self.is_clear:
|
||||
self._draw_textures(tex, self.clear_fade.attribute)
|
||||
|
||||
def _draw_textures(self, texture_index: int, color: ray.Color):
|
||||
top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index]
|
||||
for i in range(0, self.screen_width + top_texture.width, top_texture.width):
|
||||
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
|
||||
texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
|
||||
for i in range(0, self.screen_width + texture.width, texture.width):
|
||||
ray.draw_texture(texture, i + int(self.move.attribute*2), int(self.bounce_up.attribute) - int(self.bounce_down.attribute) - 25 + int(self.overlay_move.attribute) + int(self.overlay_move_2.attribute), color)
|
||||
def _draw_textures(self, tex: TextureWrapper, fade: float):
|
||||
for i in range(10):
|
||||
tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*164)+self.move.attribute)
|
||||
y = self.bounce_up.attribute - self.bounce_down.attribute + self.overlay_move.attribute + self.overlay_move_2.attribute
|
||||
for i in range(6):
|
||||
tex.draw_texture(self.name, 'overlay', frame=self.is_clear, fade=fade, x=(i*328)+(self.move.attribute*2), y=y)
|
||||
|
||||
class DonBG4(DonBGBase):
|
||||
def __init__(self, tex: TextureWrapper, index: int, screen_width: int, screen_height: int, player_num: int):
|
||||
super().__init__(tex, index, screen_width, screen_height, player_num)
|
||||
self.overlay_move = Animation.create_move(1500, start_position=0, total_distance=20, reverse_delay=0)
|
||||
self.overlay_move = tex.get_animation(2)
|
||||
self.overlay_move.start()
|
||||
def update(self, current_time_ms: float, is_clear: bool):
|
||||
super().update(current_time_ms, is_clear)
|
||||
self.overlay_move.update(current_time_ms)
|
||||
if self.overlay_move.is_finished:
|
||||
self.overlay_move.restart()
|
||||
def draw(self):
|
||||
self._draw_textures(0, ray.WHITE)
|
||||
if self.is_clear and self.clear_fade is not None:
|
||||
self._draw_textures(2, ray.fade(ray.WHITE, self.clear_fade.attribute))
|
||||
def draw(self, tex: TextureWrapper):
|
||||
self._draw_textures(tex, 1.0)
|
||||
if self.is_clear:
|
||||
self._draw_textures(tex, self.clear_fade.attribute)
|
||||
|
||||
def _draw_textures(self, texture_index: int, color: ray.Color):
|
||||
top_texture = self.textures[self.name + f'_{self.player_num}p'][texture_index]
|
||||
for i in range(0, self.screen_width + top_texture.width, top_texture.width):
|
||||
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
|
||||
|
||||
texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
|
||||
for i in range(0, self.screen_width + texture.width, texture.width):
|
||||
ray.draw_texture(texture, i + int(self.move.attribute), int(self.overlay_move.attribute) - 25, color)
|
||||
def _draw_textures(self, tex: TextureWrapper, fade: float):
|
||||
for i in range(5):
|
||||
tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute)
|
||||
tex.draw_texture(self.name, 'overlay', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute, y=self.overlay_move.attribute)
|
||||
|
||||
class DonBG5(DonBGBase):
|
||||
def __init__(self, tex: TextureWrapper, index: int, screen_width: int, screen_height: int, player_num: int):
|
||||
super().__init__(tex, index, screen_width, screen_height, player_num)
|
||||
duration = 266
|
||||
bounce_distance = 40
|
||||
self.bounce_up = Animation.create_move(duration, total_distance=-bounce_distance, ease_out='quadratic')
|
||||
self.bounce_up = tex.get_animation(4)
|
||||
self.bounce_down = tex.get_animation(5)
|
||||
self.adjust = tex.get_animation(8)
|
||||
self.bounce_up.start()
|
||||
self.bounce_down = Animation.create_move(duration, total_distance=-bounce_distance, ease_in='quadratic', delay=self.bounce_up.duration)
|
||||
self.bounce_down.start()
|
||||
self.adjust = Animation.create_move(1000, total_distance=10, reverse_delay=0, delay=self.bounce_up.duration+self.bounce_down.duration)
|
||||
self.adjust.start()
|
||||
|
||||
def update(self, current_time_ms: float, is_clear: bool):
|
||||
@@ -210,47 +181,39 @@ class DonBG5(DonBGBase):
|
||||
self.bounce_down.restart()
|
||||
self.adjust.restart()
|
||||
|
||||
def draw(self):
|
||||
self._draw_textures(0, ray.WHITE)
|
||||
if self.is_clear and self.clear_fade is not None:
|
||||
self._draw_textures(2, ray.fade(ray.WHITE, self.clear_fade.attribute))
|
||||
def draw(self, tex: TextureWrapper):
|
||||
self._draw_textures(tex, 1.0)
|
||||
if self.is_clear:
|
||||
self._draw_textures(tex, self.clear_fade.attribute)
|
||||
|
||||
def _draw_textures(self, texture_index: int, color: ray.Color):
|
||||
top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index]
|
||||
for i in range(0, self.screen_width + top_texture.width, top_texture.width):
|
||||
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
|
||||
texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
|
||||
for i in range(0, self.screen_width + texture.width + texture.width*2, texture.width*2):
|
||||
ray.draw_texture(texture, i + int((self.move.attribute * (texture.width/top_texture.width))*2), int(self.bounce_up.attribute) - int(self.bounce_down.attribute) - int(self.adjust.attribute), color)
|
||||
def _draw_textures(self, tex: TextureWrapper, fade: float):
|
||||
for i in range(5):
|
||||
tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute)
|
||||
for i in range(6):
|
||||
tex.draw_texture(self.name, 'overlay', frame=self.is_clear, fade=fade, x=(i*368)+(self.move.attribute * ((184/328)*2)), y=self.bounce_up.attribute - self.bounce_down.attribute - self.adjust.attribute)
|
||||
|
||||
class DonBG6(DonBGBase):
|
||||
def __init__(self, tex: TextureWrapper, index: int, screen_width: int, screen_height: int, player_num: int):
|
||||
super().__init__(tex, index, screen_width, screen_height, player_num)
|
||||
self.overlay_move = Animation.create_move(1000, start_position=0, total_distance=20, reverse_delay=0)
|
||||
self.overlay_move = tex.get_animation(2)
|
||||
self.overlay_move.start()
|
||||
def update(self, current_time_ms: float, is_clear: bool):
|
||||
super().update(current_time_ms, is_clear)
|
||||
self.overlay_move.update(current_time_ms)
|
||||
if self.overlay_move.is_finished:
|
||||
self.overlay_move.restart()
|
||||
def draw(self):
|
||||
self._draw_textures(0, ray.WHITE)
|
||||
if self.is_clear and self.clear_fade is not None:
|
||||
self._draw_textures(3, ray.fade(ray.WHITE, self.clear_fade.attribute))
|
||||
def draw(self, tex: TextureWrapper):
|
||||
self._draw_textures(tex, 1.0)
|
||||
if self.is_clear:
|
||||
self._draw_textures(tex, self.clear_fade.attribute)
|
||||
|
||||
def _draw_textures(self, texture_index: int, color: ray.Color):
|
||||
top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index]
|
||||
for i in range(0, self.screen_width + top_texture.width, top_texture.width):
|
||||
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
|
||||
|
||||
texture_flowers = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
|
||||
for i in range(0, self.screen_width, texture_flowers.width):
|
||||
if i % (2 * texture_flowers.width) != 0:
|
||||
ray.draw_texture(texture_flowers, i + int(self.move.attribute*3) + 100, -int(self.move.attribute*0.85)-100, color)
|
||||
|
||||
texture = self.textures[self.name + f'_{self.player_num}p'][2 + texture_index]
|
||||
for i in range(0, self.screen_width + texture.width, texture.width):
|
||||
ray.draw_texture(texture, i + int(self.move.attribute), int(self.overlay_move.attribute) - 50, color)
|
||||
def _draw_textures(self, tex: TextureWrapper, fade: float):
|
||||
for i in range(5):
|
||||
tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute)
|
||||
for i in range(0, 6, 2):
|
||||
tex.draw_texture(self.name, 'overlay_1', frame=self.is_clear, fade=fade, x=(i*264) + self.move.attribute*3, y=-self.move.attribute*0.85)
|
||||
for i in range(5):
|
||||
tex.draw_texture(self.name, 'overlay_2', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute, y=self.overlay_move.attribute)
|
||||
|
||||
class BGNormal:
|
||||
|
||||
|
||||
@@ -224,6 +224,7 @@ class GlobalData:
|
||||
song_paths: dict[Path, str] = field(default_factory=lambda: dict()) #path to hash
|
||||
song_progress: float = 0.0
|
||||
total_songs: int = 0
|
||||
player_num: int = 1
|
||||
|
||||
global_data = GlobalData()
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ from libs.texture import tex
|
||||
from libs.utils import (
|
||||
OutlinedText,
|
||||
get_current_ms,
|
||||
global_data,
|
||||
is_l_don_pressed,
|
||||
is_l_kat_pressed,
|
||||
is_r_don_pressed,
|
||||
@@ -57,6 +58,7 @@ class EntryScreen:
|
||||
|
||||
def on_screen_end(self, next_screen: str):
|
||||
self.screen_init = False
|
||||
global_data.player_num = round((self.side/3) + 1)
|
||||
audio.stop_sound(self.bgm)
|
||||
tex.unload_textures()
|
||||
audio.unload_all_sounds()
|
||||
|
||||
@@ -66,17 +66,17 @@ class GameScreen:
|
||||
self.song_music = None
|
||||
self.start_ms = (get_current_ms() - self.tja.metadata.offset*1000)
|
||||
|
||||
self.player_1 = Player(self, 1, difficulty)
|
||||
self.player_1 = Player(self, global_data.player_num, difficulty)
|
||||
|
||||
def on_screen_start(self):
|
||||
if not self.screen_init:
|
||||
self.screen_init = True
|
||||
tex.load_screen_textures('game')
|
||||
self.background = Background(self.width, self.height)
|
||||
self.background = Background(self.width, self.height, global_data.player_num)
|
||||
self.load_sounds()
|
||||
self.init_tja(global_data.selected_song, session_data.selected_difficulty)
|
||||
self.song_info = SongInfo(session_data.song_title, 'TEST')
|
||||
self.result_transition = ResultTransition()
|
||||
self.result_transition = ResultTransition(global_data.player_num)
|
||||
if self.tja is not None:
|
||||
subtitle = self.tja.metadata.subtitle.get(global_data.config['general']['language'].lower(), '')
|
||||
else:
|
||||
@@ -187,7 +187,7 @@ class Player:
|
||||
|
||||
def __init__(self, game_screen: GameScreen, player_number: int, difficulty: int):
|
||||
|
||||
self.player_number = player_number
|
||||
self.player_number = str(player_number)
|
||||
self.difficulty = difficulty
|
||||
self.visual_offset = global_data.config["general"]["visual_offset"]
|
||||
|
||||
@@ -234,7 +234,7 @@ class Player:
|
||||
stars = game_screen.tja.metadata.course_data[self.difficulty].level
|
||||
else:
|
||||
stars = 0
|
||||
self.gauge = Gauge(self.difficulty, stars, self.total_notes)
|
||||
self.gauge = Gauge(self.player_number, self.difficulty, stars, self.total_notes)
|
||||
self.gauge_hit_effect: list[GaugeHitEffect] = []
|
||||
|
||||
self.autoplay_hit_side = 'L'
|
||||
@@ -344,18 +344,18 @@ class Player:
|
||||
if self.combo > self.max_combo:
|
||||
self.max_combo = self.combo
|
||||
|
||||
self.draw_arc_list.append(NoteArc(note.type, get_current_ms(), self.player_number, note.type == 3 or note.type == 4) or note.type == 7)
|
||||
self.draw_arc_list.append(NoteArc(note.type, get_current_ms(), 1, note.type == 3 or note.type == 4) or note.type == 7)
|
||||
|
||||
if note in self.current_notes_draw:
|
||||
index = self.current_notes_draw.index(note)
|
||||
self.current_notes_draw.pop(index)
|
||||
|
||||
def check_drumroll(self, drum_type: int):
|
||||
self.draw_arc_list.append(NoteArc(drum_type, get_current_ms(), self.player_number, drum_type == 3 or drum_type == 4))
|
||||
self.draw_arc_list.append(NoteArc(drum_type, get_current_ms(), 1, drum_type == 3 or drum_type == 4))
|
||||
self.curr_drumroll_count += 1
|
||||
self.total_drumroll += 1
|
||||
self.score += 100
|
||||
self.base_score_list.append(ScoreCounterAnimation(100))
|
||||
self.base_score_list.append(ScoreCounterAnimation(self.player_number, 100))
|
||||
if not isinstance(self.current_notes_draw[0], Drumroll):
|
||||
return
|
||||
self.current_notes_draw[0].color = max(0, 255 - (self.curr_drumroll_count * 10))
|
||||
@@ -368,7 +368,7 @@ class Player:
|
||||
self.curr_balloon_count += 1
|
||||
self.total_drumroll += 1
|
||||
self.score += 100
|
||||
self.base_score_list.append(ScoreCounterAnimation(100))
|
||||
self.base_score_list.append(ScoreCounterAnimation(self.player_number, 100))
|
||||
if self.curr_balloon_count == note.count:
|
||||
self.is_balloon = False
|
||||
note.popped = True
|
||||
@@ -410,7 +410,7 @@ class Player:
|
||||
self.lane_hit_effect = LaneHitEffect('GOOD')
|
||||
self.good_count += 1
|
||||
self.score += self.base_score
|
||||
self.base_score_list.append(ScoreCounterAnimation(self.base_score))
|
||||
self.base_score_list.append(ScoreCounterAnimation(self.player_number, self.base_score))
|
||||
self.note_correct(curr_note)
|
||||
self.gauge.add_good()
|
||||
|
||||
@@ -418,7 +418,7 @@ class Player:
|
||||
self.draw_judge_list.append(Judgement('OK', big, ms_display=game_screen.current_ms - curr_note.hit_ms))
|
||||
self.ok_count += 1
|
||||
self.score += 10 * math.floor(self.base_score / 2 / 10)
|
||||
self.base_score_list.append(ScoreCounterAnimation(10 * math.floor(self.base_score / 2 / 10)))
|
||||
self.base_score_list.append(ScoreCounterAnimation(self.player_number, 10 * math.floor(self.base_score / 2 / 10)))
|
||||
self.note_correct(curr_note)
|
||||
self.gauge.add_ok()
|
||||
|
||||
@@ -624,7 +624,7 @@ class Player:
|
||||
anim.draw()
|
||||
self.draw_bars(game_screen)
|
||||
self.draw_notes(game_screen)
|
||||
tex.draw_texture('lane', 'lane_cover')
|
||||
tex.draw_texture('lane', f'{self.player_number}p_lane_cover')
|
||||
tex.draw_texture('lane', 'drum')
|
||||
if global_data.config["general"]["autoplay"]:
|
||||
tex.draw_texture('lane', 'auto_icon')
|
||||
@@ -632,7 +632,7 @@ class Player:
|
||||
anim.draw()
|
||||
self.combo_display.draw()
|
||||
tex.draw_texture('lane', 'lane_score_cover')
|
||||
tex.draw_texture('lane', '1p_icon')
|
||||
tex.draw_texture('lane', f'{self.player_number}p_icon')
|
||||
tex.draw_texture('lane', 'lane_difficulty', frame=self.difficulty)
|
||||
if self.drumroll_counter is not None:
|
||||
self.drumroll_counter.draw()
|
||||
@@ -1057,7 +1057,7 @@ class ScoreCounter:
|
||||
tex.draw_texture('lane', 'score_number', frame=int(counter[i]), x=start_x + (i * margin), y=y - self.stretch.attribute, y2=self.stretch.attribute)
|
||||
|
||||
class ScoreCounterAnimation:
|
||||
def __init__(self, counter: int):
|
||||
def __init__(self, player_num: str, counter: int):
|
||||
self.counter = counter
|
||||
self.fade_animation_1 = Animation.create_fade(50, initial_opacity=0.0, final_opacity=1.0)
|
||||
self.fade_animation_1.start()
|
||||
@@ -1072,7 +1072,10 @@ class ScoreCounterAnimation:
|
||||
self.move_animation_4 = Animation.create_move(80, delay=366.74, total_distance=10, start_position=148)
|
||||
self.move_animation_4.start()
|
||||
|
||||
self.color = ray.fade(ray.Color(254, 102, 0, 255), 1.0)
|
||||
if player_num == '2':
|
||||
self.color = ray.fade(ray.Color(84, 250, 238, 255), 1.0)
|
||||
else:
|
||||
self.color = ray.fade(ray.Color(254, 102, 0, 255), 1.0)
|
||||
self.is_finished = False
|
||||
self.y_pos_list = []
|
||||
|
||||
@@ -1085,9 +1088,9 @@ class ScoreCounterAnimation:
|
||||
self.fade_animation_2.update(current_ms)
|
||||
|
||||
if self.fade_animation_1.is_finished:
|
||||
self.color = ray.fade(ray.Color(254, 102, 0, 255), self.fade_animation_2.attribute)
|
||||
self.color = ray.fade(self.color, self.fade_animation_2.attribute)
|
||||
else:
|
||||
self.color = ray.fade(ray.Color(254, 102, 0, 255), self.fade_animation_1.attribute)
|
||||
self.color = ray.fade(self.color, self.fade_animation_1.attribute)
|
||||
if self.fade_animation_2.is_finished:
|
||||
self.is_finished = True
|
||||
self.y_pos_list = []
|
||||
@@ -1136,7 +1139,8 @@ class SongInfo:
|
||||
self.song_title.draw(self.song_title.default_src, dest, ray.Vector2(0, 0), 0, ray.fade(ray.WHITE, 1 - self.fade.attribute))
|
||||
|
||||
class ResultTransition:
|
||||
def __init__(self):
|
||||
def __init__(self, player_num: int):
|
||||
self.player_num = player_num
|
||||
self.move = global_data.tex.get_animation(5)
|
||||
self.move.reset()
|
||||
self.is_finished = False
|
||||
@@ -1154,14 +1158,15 @@ class ResultTransition:
|
||||
x = 0
|
||||
screen_width = 1280
|
||||
while x < screen_width:
|
||||
global_data.tex.draw_texture('result_transition', '1p_shutter', frame=0, x=x, y=-720 + self.move.attribute)
|
||||
global_data.tex.draw_texture('result_transition', '1p_shutter', frame=0, x=x, y=720 - self.move.attribute)
|
||||
global_data.tex.draw_texture('result_transition', '1p_shutter_footer', x=x, y=-432 + self.move.attribute)
|
||||
global_data.tex.draw_texture('result_transition', '1p_shutter_footer', x=x, y=1008 - self.move.attribute)
|
||||
global_data.tex.draw_texture('result_transition', f'{str(self.player_num)}p_shutter', frame=0, x=x, y=-720 + self.move.attribute)
|
||||
global_data.tex.draw_texture('result_transition', f'{str(self.player_num)}p_shutter', frame=0, x=x, y=720 - self.move.attribute)
|
||||
global_data.tex.draw_texture('result_transition', f'{str(self.player_num)}p_shutter_footer', x=x, y=-432 + self.move.attribute)
|
||||
global_data.tex.draw_texture('result_transition', f'{str(self.player_num)}p_shutter_footer', x=x, y=1008 - self.move.attribute)
|
||||
x += 256
|
||||
|
||||
class Gauge:
|
||||
def __init__(self, difficulty: int, level: int, total_notes: int):
|
||||
def __init__(self, player_num: str, difficulty: int, level: int, total_notes: int):
|
||||
self.player_num = player_num
|
||||
self.gauge_length = 0
|
||||
self.previous_length = 0
|
||||
self.total_notes = total_notes
|
||||
@@ -1212,12 +1217,11 @@ class Gauge:
|
||||
{"clear_rate": 61.428, "ok_multiplier": 0.5, "bad_multiplier": -2.0},
|
||||
]
|
||||
]
|
||||
self.gauge_update_anim = None
|
||||
self.gauge_update_anim = tex.get_animation(10)
|
||||
self.rainbow_fade_in = None
|
||||
self.rainbow_animation = None
|
||||
|
||||
def add_good(self):
|
||||
self.gauge_update_anim = Animation.create_fade(450)
|
||||
self.gauge_update_anim.start()
|
||||
self.previous_length = int(self.gauge_length)
|
||||
self.gauge_length += (1 / self.total_notes) * (100 * (self.clear_start[self.difficulty] / self.table[self.difficulty][self.level]["clear_rate"]))
|
||||
@@ -1225,7 +1229,6 @@ class Gauge:
|
||||
self.gauge_length = 87
|
||||
|
||||
def add_ok(self):
|
||||
self.gauge_update_anim = Animation.create_fade(450)
|
||||
self.gauge_update_anim.start()
|
||||
self.previous_length = int(self.gauge_length)
|
||||
self.gauge_length += ((1 * self.table[self.difficulty][self.level]["ok_multiplier"]) / self.total_notes) * (100 * (self.clear_start[self.difficulty] / self.table[self.difficulty][self.level]["clear_rate"]))
|
||||
@@ -1242,11 +1245,7 @@ class Gauge:
|
||||
if self.gauge_length == 87 and self.rainbow_fade_in is None:
|
||||
self.rainbow_fade_in = Animation.create_fade(450, initial_opacity=0.0, final_opacity=1.0)
|
||||
self.rainbow_fade_in.start()
|
||||
|
||||
if self.gauge_update_anim is not None:
|
||||
self.gauge_update_anim.update(current_ms)
|
||||
if self.gauge_update_anim.is_finished:
|
||||
self.gauge_update_anim = None
|
||||
self.gauge_update_anim.update(current_ms)
|
||||
|
||||
if self.rainbow_fade_in is not None:
|
||||
self.rainbow_fade_in.update(current_ms)
|
||||
@@ -1261,7 +1260,7 @@ class Gauge:
|
||||
|
||||
def draw(self):
|
||||
tex.draw_texture('gauge', 'border')
|
||||
tex.draw_texture('gauge', 'unfilled')
|
||||
tex.draw_texture('gauge', f'{self.player_num}p_unfilled')
|
||||
gauge_length = int(self.gauge_length)
|
||||
for i in range(gauge_length):
|
||||
if i == 68:
|
||||
@@ -1270,7 +1269,7 @@ class Gauge:
|
||||
tex.draw_texture('gauge', 'bar_clear_top', x=i*8)
|
||||
tex.draw_texture('gauge', 'bar_clear_bottom', x=i*8)
|
||||
else:
|
||||
tex.draw_texture('gauge', 'bar', x=i*8)
|
||||
tex.draw_texture('gauge', f'{self.player_num}p_bar', x=i*8)
|
||||
if gauge_length == 87 and self.rainbow_fade_in is not None and self.rainbow_animation is not None:
|
||||
if 0 < self.rainbow_animation.attribute < 8:
|
||||
tex.draw_texture('gauge', 'rainbow', frame=self.rainbow_animation.attribute-1, fade=self.rainbow_fade_in.attribute)
|
||||
@@ -1281,7 +1280,7 @@ class Gauge:
|
||||
elif gauge_length > 69:
|
||||
tex.draw_texture('gauge', 'bar_clear_fade', x=gauge_length*8, fade=self.gauge_update_anim.attribute)
|
||||
else:
|
||||
tex.draw_texture('gauge', 'bar_fade', x=gauge_length*8, fade=self.gauge_update_anim.attribute)
|
||||
tex.draw_texture('gauge', f'{self.player_num}p_bar_fade', x=gauge_length*8, fade=self.gauge_update_anim.attribute)
|
||||
tex.draw_texture('gauge', 'overlay', fade=0.15)
|
||||
if gauge_length >= 69:
|
||||
tex.draw_texture('gauge', 'clear')
|
||||
|
||||
@@ -118,7 +118,7 @@ class ResultScreen:
|
||||
|
||||
self.fade_in.update(get_current_ms())
|
||||
if self.fade_in.is_finished and self.gauge is None:
|
||||
self.gauge = Gauge(session_data.result_gauge_length)
|
||||
self.gauge = Gauge(str(global_data.player_num), session_data.result_gauge_length)
|
||||
self.bottom_characters.start()
|
||||
|
||||
self.bottom_characters.update(self.state)
|
||||
@@ -192,10 +192,10 @@ class ResultScreen:
|
||||
def draw(self):
|
||||
x = 0
|
||||
while x < self.width:
|
||||
tex.draw_texture('background', 'background_1p', x=x, y=-360)
|
||||
tex.draw_texture('background', 'background_1p', x=x, y=360)
|
||||
tex.draw_texture('background', 'footer_1p', x=x, y=-77)
|
||||
tex.draw_texture('background', 'footer_1p', x=x, y=653)
|
||||
tex.draw_texture('background', f'background_{str(global_data.player_num)}p', x=x, y=-360)
|
||||
tex.draw_texture('background', f'background_{str(global_data.player_num)}p', x=x, y=360)
|
||||
tex.draw_texture('background', f'footer_{str(global_data.player_num)}p', x=x, y=-77)
|
||||
tex.draw_texture('background', f'footer_{str(global_data.player_num)}p', x=x, y=653)
|
||||
x += 256
|
||||
|
||||
tex.draw_texture('background', 'result_text')
|
||||
@@ -353,10 +353,10 @@ class FadeIn:
|
||||
def draw(self):
|
||||
x = 0
|
||||
while x < 1280:
|
||||
tex.draw_texture('background', 'background_1p', x=x, y=-360, fade=self.fadein.attribute)
|
||||
tex.draw_texture('background', 'background_1p', x=x, y=360, fade=self.fadein.attribute)
|
||||
tex.draw_texture('background', 'footer_1p', x=x, y=-77, fade=self.fadein.attribute)
|
||||
tex.draw_texture('background', 'footer_1p', x=x, y=653, fade=self.fadein.attribute)
|
||||
tex.draw_texture('background', f'background_{str(global_data.player_num)}p', x=x, y=-360, fade=self.fadein.attribute)
|
||||
tex.draw_texture('background', f'background_{str(global_data.player_num)}p', x=x, y=360, fade=self.fadein.attribute)
|
||||
tex.draw_texture('background', f'footer_{str(global_data.player_num)}p', x=x, y=-77, fade=self.fadein.attribute)
|
||||
tex.draw_texture('background', f'footer_{str(global_data.player_num)}p', x=x, y=653, fade=self.fadein.attribute)
|
||||
x += 256
|
||||
|
||||
class ScoreAnimator:
|
||||
@@ -380,7 +380,8 @@ class ScoreAnimator:
|
||||
return int(''.join([str(item[0]) for item in self.current_score_list]))
|
||||
|
||||
class Gauge:
|
||||
def __init__(self, gauge_length):
|
||||
def __init__(self, player_num: str, gauge_length: int):
|
||||
self.player_num = player_num
|
||||
self.gauge_length = gauge_length
|
||||
self.rainbow_animation = tex.get_animation(16)
|
||||
self.gauge_fade_in = tex.get_animation(17)
|
||||
@@ -403,7 +404,7 @@ class Gauge:
|
||||
|
||||
def draw(self):
|
||||
scale = 10/11
|
||||
tex.draw_texture('gauge', 'unfilled', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', f'{self.player_num}p_unfilled', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
gauge_length = int(self.gauge_length)
|
||||
if gauge_length == 87:
|
||||
if 0 < self.rainbow_animation.attribute < 8:
|
||||
@@ -422,8 +423,8 @@ class Gauge:
|
||||
tex.draw_texture('gauge', 'bar_clear_bottom', x=width+1, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
else:
|
||||
if i % 5 == 0:
|
||||
tex.draw_texture('gauge', 'bar', x=width, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'bar', x=width+1, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', f'{self.player_num}p_bar', x=width, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', f'{self.player_num}p_bar', x=width+1, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'overlay', scale=scale, fade=min(0.15, self.gauge_fade_in.attribute))
|
||||
tex.draw_texture('gauge', 'footer', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
|
||||
|
||||
@@ -251,6 +251,7 @@ class SongSelectScreen:
|
||||
self.background_fade_change.start()
|
||||
if self.background_fade_change.is_finished:
|
||||
self.last_texture_index = self.texture_index
|
||||
self.background_fade_change.reset()
|
||||
|
||||
if self.game_transition is not None:
|
||||
self.game_transition.update(get_current_ms())
|
||||
@@ -285,18 +286,18 @@ class SongSelectScreen:
|
||||
|
||||
def draw_selector(self):
|
||||
if self.selected_difficulty == -1:
|
||||
tex.draw_texture('diff_select', '1p_outline_back')
|
||||
tex.draw_texture('diff_select', f'{str(global_data.player_num)}p_outline_back')
|
||||
else:
|
||||
difficulty = min(3, self.selected_difficulty)
|
||||
tex.draw_texture('diff_select', '1p_balloon', x=(difficulty * 115))
|
||||
tex.draw_texture('diff_select', '1p_outline', x=(difficulty * 115))
|
||||
tex.draw_texture('diff_select', f'{str(global_data.player_num)}p_balloon', x=(difficulty * 115))
|
||||
tex.draw_texture('diff_select', f'{str(global_data.player_num)}p_outline', x=(difficulty * 115))
|
||||
|
||||
def draw(self):
|
||||
# Draw file/directory list
|
||||
width = tex.textures['box']['background'].width
|
||||
for i in range(0, width * 4, width):
|
||||
tex.draw_texture('box', 'background', frame=self.last_texture_index, x=i - int(self.background_move.attribute))
|
||||
tex.draw_texture('box', 'background', frame=self.texture_index, x=i - int(self.background_move.attribute), fade=1 - self.background_fade_change.attribute)
|
||||
tex.draw_texture('box', 'background', frame=self.last_texture_index, x=i-self.background_move.attribute)
|
||||
tex.draw_texture('box', 'background', frame=self.texture_index, x=i-self.background_move.attribute, fade=1 - self.background_fade_change.attribute)
|
||||
|
||||
if self.navigator.genre_bg is not None and self.state == State.BROWSING:
|
||||
self.navigator.genre_bg.draw(95)
|
||||
|
||||
Reference in New Issue
Block a user