mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
add gogotime
This commit is contained in:
@@ -11,7 +11,8 @@ class Chara2D:
|
||||
self.past_anim = 'normal'
|
||||
self.is_rainbow = False
|
||||
self.is_clear = False
|
||||
self.temp_anims = {'10_combo','10_combo_max', 'soul_in', 'clear_in', 'balloon_pop', 'balloon_miss'}
|
||||
self.is_gogo = False
|
||||
self.temp_anims = {'10_combo','10_combo_max', 'soul_in', 'clear_in', 'balloon_pop', 'balloon_miss', 'gogo_start'}
|
||||
for name in self.tex.textures[self.name]:
|
||||
tex_list = self.tex.textures[self.name][name].texture
|
||||
keyframe_len = len(tex_list) if isinstance(tex_list, list) else 1
|
||||
@@ -30,11 +31,21 @@ class Chara2D:
|
||||
return
|
||||
if self.current_anim in self.temp_anims:
|
||||
return
|
||||
if self.is_gogo and name == '10_combo':
|
||||
return
|
||||
self.past_anim = self.current_anim
|
||||
if name == 'balloon_pop' or name == 'balloon_miss':
|
||||
if name == 'balloon_pop' or name == 'balloon_miss' or name == 'gogo_stop':
|
||||
self.past_anim = 'normal'
|
||||
if self.is_clear:
|
||||
self.past_anim = 'clear'
|
||||
if self.is_gogo:
|
||||
self.past_anim = 'gogo'
|
||||
if name == 'gogo_stop':
|
||||
name = self.past_anim
|
||||
self.is_gogo = False
|
||||
elif name == 'gogo_start':
|
||||
self.is_gogo = True
|
||||
self.past_anim = 'gogo'
|
||||
self.current_anim = name
|
||||
self.anims[name].start()
|
||||
def update(self, current_time_ms: float, bpm: float, is_clear: bool, is_rainbow: bool):
|
||||
|
||||
@@ -2,7 +2,7 @@ import pyray as ray
|
||||
|
||||
from libs.utils import get_current_ms
|
||||
from libs.texture import tex
|
||||
from scenes.game import NoteArc
|
||||
from scenes.game import GogoTime, NoteArc
|
||||
|
||||
|
||||
class DevScreen:
|
||||
@@ -16,8 +16,7 @@ class DevScreen:
|
||||
if not self.screen_init:
|
||||
self.screen_init = True
|
||||
tex.load_screen_textures('game')
|
||||
self.mask_shader = ray.load_shader("", "shader/mask.fs")
|
||||
self.note_arc = NoteArc(4, get_current_ms(), 1, True, True)
|
||||
self.obj = GogoTime()
|
||||
|
||||
def on_screen_end(self, next_screen: str):
|
||||
self.screen_init = False
|
||||
@@ -25,15 +24,15 @@ class DevScreen:
|
||||
|
||||
def update(self):
|
||||
self.on_screen_start()
|
||||
self.note_arc.update(get_current_ms())
|
||||
self.obj.update(get_current_ms())
|
||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_ENTER):
|
||||
return self.on_screen_end('GAME')
|
||||
elif ray.is_key_pressed(ray.KeyboardKey.KEY_SPACE):
|
||||
self.note_arc = NoteArc(4, get_current_ms(), 1, True, True)
|
||||
self.obj = GogoTime()
|
||||
|
||||
def draw(self):
|
||||
ray.draw_rectangle(0, 0, 1280, 720, ray.GREEN)
|
||||
self.note_arc.draw(self.mask_shader)
|
||||
self.obj.draw()
|
||||
|
||||
def draw_3d(self):
|
||||
pass
|
||||
|
||||
@@ -269,6 +269,8 @@ class Player:
|
||||
self.base_score_list: list[ScoreCounterAnimation] = []
|
||||
self.combo_display = Combo(self.combo, 0)
|
||||
self.score_counter = ScoreCounter(self.score)
|
||||
self.gogo_time: Optional[GogoTime] = None
|
||||
self.is_gogo_time = self.play_notes[0].gogo_time if self.play_notes else False
|
||||
plate_info = global_data.config['nameplate']
|
||||
self.nameplate = Nameplate(plate_info['name'], plate_info['title'], global_data.player_num, plate_info['dan'], plate_info['gold'])
|
||||
self.chara = Chara2D(player_number - 1, self.bpm)
|
||||
@@ -608,6 +610,8 @@ class Player:
|
||||
self.drumroll_counter_manager(current_time)
|
||||
self.animation_manager(self.draw_judge_list, current_time)
|
||||
self.balloon_manager(current_time)
|
||||
if self.gogo_time is not None:
|
||||
self.gogo_time.update(current_time)
|
||||
if self.lane_hit_effect is not None:
|
||||
self.lane_hit_effect.update(current_time)
|
||||
self.animation_manager(self.draw_drum_hit_list, current_time)
|
||||
@@ -631,6 +635,14 @@ class Player:
|
||||
self.gauge.update(current_time)
|
||||
if self.play_notes:
|
||||
self.bpm = self.play_notes[0].bpm
|
||||
if self.play_notes[0].gogo_time and not self.is_gogo_time:
|
||||
self.is_gogo_time = True
|
||||
self.gogo_time = GogoTime()
|
||||
self.chara.set_animation('gogo_start')
|
||||
if not self.play_notes[0].gogo_time and self.is_gogo_time:
|
||||
self.is_gogo_time = False
|
||||
self.gogo_time = None
|
||||
self.chara.set_animation('gogo_stop')
|
||||
self.chara.update(current_time, self.bpm, self.gauge.is_clear, self.gauge.is_rainbow)
|
||||
|
||||
def draw_drumroll(self, current_ms: float, head: Drumroll, current_eighth: int):
|
||||
@@ -771,6 +783,8 @@ class Player:
|
||||
# Group 2: Judgement and hit effects
|
||||
for anim in self.draw_judge_list:
|
||||
anim.draw()
|
||||
if self.gogo_time is not None:
|
||||
self.gogo_time.draw()
|
||||
|
||||
# Group 3: Notes and bars (game content)
|
||||
self.draw_bars(current_ms)
|
||||
@@ -1470,6 +1484,28 @@ class ResultTransition:
|
||||
global_tex.draw_texture('result_transition', f'{str(self.player_num)}p_shutter_footer', x=x, y=1008 - self.move.attribute)
|
||||
x += 256
|
||||
|
||||
class GogoTime:
|
||||
def __init__(self):
|
||||
self.explosion_anim = tex.get_animation(23)
|
||||
self.fire_resize = tex.get_animation(24)
|
||||
self.fire_change = tex.get_animation(25)
|
||||
|
||||
self.explosion_anim.start()
|
||||
self.fire_resize.start()
|
||||
self.fire_change.start()
|
||||
def update(self, current_time_ms: float):
|
||||
self.explosion_anim.update(current_time_ms)
|
||||
self.fire_resize.update(current_time_ms)
|
||||
self.fire_change.update(current_time_ms)
|
||||
|
||||
def draw(self):
|
||||
tex.draw_texture('gogo_time', 'fire', scale=self.fire_resize.attribute, frame=self.fire_change.attribute, fade=0.5, center=True)
|
||||
if not self.explosion_anim.is_finished:
|
||||
ray.begin_blend_mode(ray.BlendMode.BLEND_ADDITIVE)
|
||||
for i in range(5):
|
||||
tex.draw_texture('gogo_time', 'explosion', frame=self.explosion_anim.attribute, index=i)
|
||||
ray.end_blend_mode()
|
||||
|
||||
class Gauge:
|
||||
def __init__(self, player_num: str, difficulty: int, level: int, total_notes: int):
|
||||
self.player_num = player_num
|
||||
|
||||
@@ -502,5 +502,5 @@ class Gauge:
|
||||
tex.draw_texture('gauge', 'clear', scale=scale, fade=self.gauge_fade_in.attribute, index=self.difficulty)
|
||||
tex.draw_texture('gauge', 'tamashii', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
else:
|
||||
tex.draw_texture('gauge', 'clear_dark', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'clear_dark', scale=scale, fade=self.gauge_fade_in.attribute, index=self.difficulty)
|
||||
tex.draw_texture('gauge', 'tamashii_dark', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
|
||||
Reference in New Issue
Block a user