mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
add 1080p and more support
This commit is contained in:
@@ -17,6 +17,7 @@ class BGFever:
|
||||
class BGFeverBase:
|
||||
def __init__(self, tex: TextureWrapper, index: int, path: str):
|
||||
self.name = 'bg_fever_' + str(index)
|
||||
self.tex = tex
|
||||
tex.load_zip(path, f'bg_fever/{self.name}')
|
||||
self.transitioned = False
|
||||
def start(self):
|
||||
@@ -28,13 +29,13 @@ class BGFeverBase:
|
||||
|
||||
class BGFever1(BGFeverBase):
|
||||
class Tile:
|
||||
def __init__(self):
|
||||
self.expansion = Animation.create_move(166, total_distance=360)
|
||||
def __init__(self, tex):
|
||||
self.expansion = Animation.create_move(166, total_distance=tex.screen_height//2)
|
||||
self.expansion.start()
|
||||
def update(self, current_time_ms):
|
||||
self.expansion.update(current_time_ms)
|
||||
def draw(self, tex: TextureWrapper, name: str, x: int, frame: int):
|
||||
tex.draw_texture(name, 'background', frame=frame, x=x, y2=-360+self.expansion.attribute, y=360+(180-self.expansion.attribute/2))
|
||||
tex.draw_texture(name, 'background', frame=frame, x=x, y2=-tex.screen_height//2+self.expansion.attribute, y=tex.screen_height//2+(tex.screen_height//4-self.expansion.attribute/2))
|
||||
def __init__(self, tex: TextureWrapper, index: int, path):
|
||||
super().__init__(tex, index, path)
|
||||
self.wait = 0
|
||||
@@ -89,7 +90,7 @@ class BGFever1(BGFeverBase):
|
||||
|
||||
def update(self, current_time_ms: float):
|
||||
if len(self.bg_tiles) < 20 and current_time_ms >= self.wait + 66:
|
||||
self.bg_tiles.append(BGFever1.Tile())
|
||||
self.bg_tiles.append(BGFever1.Tile(self.tex))
|
||||
self.wait = current_time_ms
|
||||
for tile in self.bg_tiles:
|
||||
tile.update(current_time_ms)
|
||||
|
||||
@@ -15,6 +15,7 @@ class BGNormal:
|
||||
class BGNormalBase:
|
||||
def __init__(self, tex: TextureWrapper, index: int, path: str):
|
||||
self.name = "bg_" + str(index)
|
||||
self.tex = tex
|
||||
tex.load_zip(path, f'bg_normal/{self.name}')
|
||||
def update(self, current_time_ms: float):
|
||||
pass
|
||||
@@ -69,29 +70,29 @@ class BGNormal3(BGNormalBase):
|
||||
|
||||
class BGNormal4(BGNormalBase):
|
||||
class Petal:
|
||||
def __init__(self):
|
||||
self.spawn_point = self.random_excluding_range()
|
||||
def __init__(self, tex: TextureWrapper):
|
||||
self.spawn_point = self.random_excluding_range(tex.screen_width)
|
||||
duration = random.randint(1400, 2000)
|
||||
self.move_x = Animation.create_move(duration, total_distance=random.randint(-300, 300))
|
||||
self.move_y = Animation.create_move(duration, total_distance=360)
|
||||
self.move_y = Animation.create_move(duration, total_distance=tex.screen_height//2)
|
||||
self.move_x.start()
|
||||
self.move_y.start()
|
||||
def random_excluding_range(self):
|
||||
def random_excluding_range(self, screen_width):
|
||||
while True:
|
||||
num = random.randint(0, 1280)
|
||||
num = random.randint(0, screen_width)
|
||||
if num < 260 or num > 540:
|
||||
return num
|
||||
def update(self, current_time_ms):
|
||||
self.move_x.update(current_time_ms)
|
||||
self.move_y.update(current_time_ms)
|
||||
def draw(self, name: str, tex: TextureWrapper):
|
||||
tex.draw_texture(name, 'petal', x=self.spawn_point + self.move_x.attribute, y=360+self.move_y.attribute, fade=0.75)
|
||||
tex.draw_texture(name, 'petal', x=self.spawn_point + self.move_x.attribute, y=tex.screen_height//2+self.move_y.attribute, fade=0.75)
|
||||
def __init__(self, tex: TextureWrapper, index: int, path: str):
|
||||
super().__init__(tex, index, path)
|
||||
self.flicker = tex.get_animation(11)
|
||||
self.turtle_move = tex.get_animation(12)
|
||||
self.turtle_change = tex.get_animation(13)
|
||||
self.petals = {self.Petal(), self.Petal(), self.Petal(), self.Petal(), self.Petal()}
|
||||
self.petals = {self.Petal(tex), self.Petal(tex), self.Petal(tex), self.Petal(tex), self.Petal(tex)}
|
||||
def update(self, current_time_ms: float):
|
||||
self.flicker.update(current_time_ms)
|
||||
self.turtle_move.update(current_time_ms)
|
||||
@@ -100,7 +101,7 @@ class BGNormal4(BGNormalBase):
|
||||
petal.update(current_time_ms)
|
||||
if petal.move_y.is_finished:
|
||||
self.petals.remove(petal)
|
||||
self.petals.add(self.Petal())
|
||||
self.petals.add(self.Petal(self.tex))
|
||||
def draw(self, tex: TextureWrapper):
|
||||
tex.draw_texture(self.name, 'background')
|
||||
tex.draw_texture(self.name, 'chara')
|
||||
|
||||
@@ -20,9 +20,10 @@ class BaseChibi:
|
||||
self.name = 'chibi_' + str(index)
|
||||
self.bpm = bpm
|
||||
self.is_2p = is_2p
|
||||
self.hori_move = Animation.create_move(60000 / self.bpm * 5, total_distance=1280)
|
||||
self.tex = tex
|
||||
self.hori_move = Animation.create_move(60000 / self.bpm * 5, total_distance=tex.screen_width)
|
||||
self.hori_move.start()
|
||||
self.vert_move = Animation.create_move(60000 / self.bpm / 2, total_distance=50, reverse_delay=0)
|
||||
self.vert_move = Animation.create_move(60000 / self.bpm / 2, total_distance=50 * tex.screen_scale, reverse_delay=0)
|
||||
self.vert_move.start()
|
||||
self.index = random.randint(0, len([item for item in tex.textures[self.name] if item[0].isdigit()])-1)
|
||||
tex_list = tex.textures[self.name][str(self.index)].texture
|
||||
@@ -47,9 +48,9 @@ class BaseChibi:
|
||||
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)
|
||||
self.texture_change.start()
|
||||
self.hori_move = Animation.create_move(60000 / self.bpm * 5, total_distance=1280)
|
||||
self.hori_move = Animation.create_move(60000 / self.bpm * 5, total_distance=self.tex.screen_width)
|
||||
self.hori_move.start()
|
||||
self.vert_move = Animation.create_move(60000 / self.bpm / 2, total_distance=50, reverse_delay=0)
|
||||
self.vert_move = Animation.create_move(60000 / self.bpm / 2, total_distance=50 * self.tex.screen_scale, reverse_delay=0)
|
||||
self.vert_move.start()
|
||||
|
||||
def draw(self, tex: TextureWrapper):
|
||||
@@ -62,9 +63,9 @@ class ChibiBad(BaseChibi):
|
||||
self.index = random.randint(0, 2)
|
||||
self.keyframes = [3, 4]
|
||||
duration = (60000 / self.bpm) / 2
|
||||
self.hori_move = Animation.create_move(duration * 10, total_distance=1280)
|
||||
self.hori_move = Animation.create_move(duration * 10, total_distance=1280 * self.tex.screen_width)
|
||||
self.hori_move.start()
|
||||
self.vert_move = Animation.create_move(duration, total_distance=50, reverse_delay=0)
|
||||
self.vert_move = Animation.create_move(duration, total_distance=50 * self.tex.screen_scale, reverse_delay=0)
|
||||
self.vert_move.start()
|
||||
self.fade_in = Animation.create_fade(duration, initial_opacity=0.0, final_opacity=1.0)
|
||||
self.fade_in.start()
|
||||
@@ -95,7 +96,7 @@ class Chibi0(BaseChibi):
|
||||
class Chibi2(BaseChibi):
|
||||
def __init__(self, index: int, bpm: float, tex: TextureWrapper, is_2p: bool):
|
||||
super().__init__(index, bpm, tex, is_2p)
|
||||
self.rotate = Animation.create_move(60000 / self.bpm, total_distance=360)
|
||||
self.rotate = Animation.create_move(60000 / self.bpm, total_distance=self.tex.screen_height//2)
|
||||
self.rotate.start()
|
||||
|
||||
def update(self, current_time_ms: float, bpm: float):
|
||||
|
||||
@@ -165,7 +165,7 @@ class BaseDancerGroup():
|
||||
dancer.update(current_time_ms, bpm)
|
||||
|
||||
def draw(self, tex: TextureWrapper):
|
||||
total_width = 1280
|
||||
total_width = tex.screen_width
|
||||
num_dancers = len(self.active_dancers)
|
||||
|
||||
first_dancer = next((dancer for dancer in self.active_dancers if dancer is not None), None)
|
||||
|
||||
@@ -15,7 +15,7 @@ class Renda:
|
||||
class BaseRenda:
|
||||
def __init__(self, tex: TextureWrapper, index: int):
|
||||
self.name = 'renda_' + str(index)
|
||||
self.hori_move = Animation.create_move(1500, total_distance=1280)
|
||||
self.hori_move = Animation.create_move(1500, total_distance=tex.screen_width)
|
||||
self.hori_move.start()
|
||||
|
||||
def update(self, current_time_ms: float):
|
||||
@@ -24,13 +24,13 @@ class BaseRenda:
|
||||
class Renda0(BaseRenda):
|
||||
def __init__(self, tex: TextureWrapper, index: int):
|
||||
super().__init__(tex, index)
|
||||
self.vert_move = Animation.create_move(1500, total_distance=800)
|
||||
self.vert_move = Animation.create_move(1500, total_distance=tex.screen_height + (80 * tex.screen_scale))
|
||||
self.vert_move.start()
|
||||
tex_list = tex.textures['renda'][self.name].texture
|
||||
num_of_rendas = len(tex_list) if isinstance(tex_list, list) else 0
|
||||
self.frame = random.randint(0, num_of_rendas - 1)
|
||||
self.x = random.randint(0, 500)
|
||||
self.y = random.randint(0, 20)
|
||||
self.x = random.randint(0, int(500 * tex.screen_scale))
|
||||
self.y = random.randint(0, int(20 * tex.screen_scale))
|
||||
|
||||
def update(self, current_time_ms: float):
|
||||
super().update(current_time_ms)
|
||||
@@ -43,8 +43,8 @@ class Renda1(BaseRenda):
|
||||
def __init__(self, tex: TextureWrapper, index: int):
|
||||
super().__init__(tex, index)
|
||||
self.frame = random.randint(0, 5)
|
||||
self.y = random.randint(0, 200)
|
||||
self.rotate = Animation.create_move(800, total_distance=360)
|
||||
self.y = random.randint(0, int(200 * tex.screen_scale))
|
||||
self.rotate = Animation.create_move(800, total_distance=tex.screen_height//2)
|
||||
self.rotate.start()
|
||||
self.origin = ray.Vector2(64, 64)
|
||||
|
||||
@@ -60,10 +60,10 @@ class Renda1(BaseRenda):
|
||||
class Renda2(BaseRenda):
|
||||
def __init__(self, tex: TextureWrapper, index: int):
|
||||
super().__init__(tex, index)
|
||||
self.vert_move = Animation.create_move(1500, total_distance=800)
|
||||
self.vert_move = Animation.create_move(1500, total_distance=tex.screen_height + (80 * tex.screen_scale))
|
||||
self.vert_move.start()
|
||||
self.x = random.randint(0, 500)
|
||||
self.y = random.randint(0, 20)
|
||||
self.x = random.randint(0, int(500 * tex.screen_scale))
|
||||
self.y = random.randint(0, int(20 * tex.screen_scale))
|
||||
|
||||
def update(self, current_time_ms: float):
|
||||
super().update(current_time_ms)
|
||||
|
||||
Reference in New Issue
Block a user