def __init__(self, event_player: 'EventPlayer', *args, **kwargs): super(EventDialogue, self).__init__(*args, **kwargs) self.gm = pge.GameManager() self.event_player: 'EventPlayer' = event_player self.inner_text: pge.Text = pge.Text( center=[pge.Alignment.LEFT, pge.Alignment.TOP]) self.char_name = pge.Sprite() self.char_name.center = [pge.Alignment.LEFT, pge.Alignment.BOTTOM] self.inp = pge.Input() self.current_line = 0 self.current_pause = 0 self.text_left_to_do = "" self.current_text = "" self.paused = False self.current_time_between_progress = 0 self.time_to_progress = 1 / 60 self.character_talking: EventCharacter = None self.voice_player = pg_utils.sound.SADLStreamPlayer.SADLStreamPlayer() self.voice_player.set_volume(0.75) self.voice_line = -1 self.dialogue_sfx_player = pg_utils.sound.SADLStreamPlayer.SADLStreamPlayer( ) self.dialogue_sfx_player.set_volume(0.5) self.dialogue_sfx_id = -1 self.on_dialogue = False
def __init__(self): super(PreviewerDefaultRenderer, self).__init__() sprite_loader = pge.SpriteLoaderOS(base_path_os="data_permanent/sprites") font_loader = pge.FontLoaderOS(base_path_os="data_permanent/fonts", fall_back_font_os="../font_default.json") self.tth_logo = pge.Sprite() sprite_loader.load("team_top_hat_logo.png", self.tth_logo) self.tth_logo.set_size([128, 128], conserve_ratio=True, ratio_type=self.tth_logo.SNAP_MIN) self.previewer_text = pge.Text(text="Game Previewer", color=pg.Color(240, 240, 240)) font_loader.load("consolas", 24, self.previewer_text)
def __init__(self, name="unnamed"): self.bg = ScreenShaker() self.fader = ScreenFader() self.fader.load_fader() self.translucent = pge.Sprite() surf = pg.Surface([256, 192]) surf.fill(pg.Color(0, 0, 0)) self.translucent.surf = surf self.translucent.alpha = 0 self.name = name
def __init__(self, character_id, slot, anim_num, visibility, loader, *args, **kwargs): super(EventCharacter, self).__init__(*args, **kwargs) self.orientation = EventCharacter.FACING_RIGHT self.center[1] = pge.Alignment.BOTTOM self.position[1] = 192 // 2 self.slot = slot self.character_mouth: pge.Sprite = pge.Sprite() self.char_id = character_id self.talking = False self.load_character(loader) self.set_tag_by_num(anim_num) self.set_visibility(visibility)
def __init__(self, place: Place): super(PlacePreview, self).__init__() self.place = place self.sprite_loader = RomSingleton().get_sprite_loader() self.font_loader = RomSingleton().get_font_loader() self.inp = pge.Input() self.top_bg = pge.Sprite() self.sprite_loader.load( f"data_lt2/bg/map/map{self.place.map_image_index}", self.top_bg, sprite_sheet=False, convert_alpha=False) self.btm_bg = pge.Sprite() self.sprite_loader.load( f"data_lt2/bg/map/main{self.place.background_image_index}", self.btm_bg, sprite_sheet=False, convert_alpha=False) self.map_icon = pge.Sprite( position=[ self.place.map_x - 256 // 2, self.place.map_y - 192 // 2 ], center=[pge.Alignment.LEFT, pge.Alignment.TOP]) self.sprite_loader.load(f"data_lt2/ani/map/mapicon.arj", self.map_icon, sprite_sheet=True, convert_alpha=False) self.move_mode = False self.move_button = pge.Button( position=[256 // 2 - 3, 192 // 2 - 3], center=[pge.Alignment.RIGHT, pge.Alignment.BOTTOM], pressed_tag="on", not_pressed_tag="off") self.sprite_loader.load(f"data_lt2/ani/map/movemode.arc", self.move_button, sprite_sheet=True, convert_alpha=False) self.bgm = SMDLStreamPlayer() self.sprites = [] self.objects = [] self.exits = [] for sprite_obj in self.place.sprites: if sprite_obj.filename == "": continue sprite = pge.Sprite( position=[sprite_obj.x - 256 // 2, sprite_obj.y - 192 // 2], center=[pge.Alignment.LEFT, pge.Alignment.TOP], color_key=pg.Color(0, 255, 0)) self.sprite_loader.load( f"data_lt2/ani/bgani/{sprite_obj.filename}", sprite, sprite_sheet=True, convert_alpha=False) sprite.set_tag("gfx") self.sprites.append(sprite) for object_obj in self.place.objects: if object_obj.width <= 0: continue obj = pge.Sprite( position=[object_obj.x - 256 // 2, object_obj.y - 192 // 2], center=[pge.Alignment.LEFT, pge.Alignment.TOP], color_key=pg.Color(0, 255, 0)) if object_obj.character_index != 0: self.sprite_loader.load( f"data_lt2/ani/eventobj/obj_{object_obj.character_index}.arc", obj, sprite_sheet=True, convert_alpha=False) obj.set_tag("gfx") self.objects.append(obj) for exit_obj in self.place.exits: if exit_obj.width <= 0: continue exit_ = FadeInOutBtn( position=[exit_obj.x - 256 // 2, exit_obj.y - 192 // 2], center=[pge.Alignment.LEFT, pge.Alignment.TOP], color_key=pg.Color(0, 255, 0), pressed_tag="gfx2", not_pressed_tag="gfx") self.sprite_loader.load( f"data_lt2/ani/map/exit_{exit_obj.image_index}.arc", exit_, sprite_sheet=True, convert_alpha=False) self.exits.append(exit_)
def __init__(self, puzzle_data: pzd.Puzzle): super(PuzzlePlayer, self).__init__() self.hints_used = 0 self.selected_hint = 0 self.text_pos = 0 self.between_letters = 0.017 self.current_between_letters = 0.0 self.on_hints = False self.puzzle_data = puzzle_data self.inp = pge.Input() self.sprite_loader: pge.SpriteLoader = RomSingleton( ).get_sprite_loader() self.font_loader: pge.FontLoader = RomSingleton().get_font_loader() self.top_bg = pge.Sprite() self.sprite_loader.load( f"data_lt2/bg/nazo/system/nazo_text{puzzle_data.bg_top_id}.arc", self.top_bg, sprite_sheet=False) self.btm_bg = pge.Sprite() if not puzzle_data.bg_lang: self.sprite_loader.load( f"data_lt2/bg/nazo/q{puzzle_data.internal_id}.arc", self.btm_bg, sprite_sheet=False) else: self.sprite_loader.load( f"data_lt2/bg/nazo/?/q{puzzle_data.internal_id}.arc", self.btm_bg, sprite_sheet=False) self.top_text = pge.Text( position=[-256 // 2 + 8, -192 // 2 + 23], center=[pge.Alignment.LEFT, pge.Alignment.TOP], color=pg.Color(0, 0, 0), line_spacing=2) self.font_loader.load("fontq", 10, self.top_text) self.header_top_left = [] for i in range(4): header_item = pge.Sprite( center=[pge.Alignment.TOP, pge.Alignment.LEFT]) self.sprite_loader.load( f"data_lt2/ani/nazo/system/?/nazo_text.arc", header_item, sprite_sheet=True) if i == 0: header_item.set_tag("nazo") header_item.position = [-256 // 2 + 5, -192 // 2 + 4] else: i -= 1 p_num = puzzle_data.number for a in range(2 - i): p_num //= 10 header_item.set_tag(str(p_num % 10)) header_item.position = [-256 // 2 + 23 + i * 7, -192 // 2 + 5] self.header_top_left.append(header_item) self.hint_bg = pge.Sprite() btn_off = "off" btn_on = "on" current_y = -192 // 2 self.hints_btn = pge.Button( center=[pge.Alignment.RIGHT, pge.Alignment.TOP], position=[256 // 2, current_y], not_pressed_tag="0_off", pressed_tag="0_on") self.sprite_loader.load("data_lt2/ani/system/btn/?/hint.arc", self.hints_btn, sprite_sheet=True) current_y += self.hints_btn.get_world_rect().h self.quit_btn = pge.Button( center=[pge.Alignment.RIGHT, pge.Alignment.TOP], position=[256 // 2, current_y], not_pressed_tag=btn_off, pressed_tag=btn_on) self.sprite_loader.load("data_lt2/ani/system/btn/?/atode.arc", self.quit_btn, sprite_sheet=True) current_y += self.quit_btn.get_world_rect().h self.memo_btn = pge.Button( center=[pge.Alignment.RIGHT, pge.Alignment.TOP], position=[256 // 2, current_y], not_pressed_tag=btn_off, pressed_tag=btn_on) self.sprite_loader.load("data_lt2/ani/system/btn/?/memo.arc", self.memo_btn, sprite_sheet=True) self.submit_btn = pge.Button( center=[pge.Alignment.RIGHT, pge.Alignment.BOTTOM], position=[256 // 2, 192 // 2], not_pressed_tag=btn_off, pressed_tag=btn_on) self.sprite_loader.load("data_lt2/ani/system/btn/?/hantei.arc", self.submit_btn, sprite_sheet=True) self.hint_back = pge.Button( position=[256 // 2, -192 // 2], center=[pge.Alignment.RIGHT, pge.Alignment.TOP], not_pressed_tag=btn_off, pressed_tag=btn_on) self.sprite_loader.load("data_lt2/ani/system/btn/?/modoru_memo.arc", self.hint_back, sprite_sheet=True) self.hint_unlock = pge.Button( position=[-80, 40], center=[pge.Alignment.LEFT, pge.Alignment.TOP], not_pressed_tag=btn_off, pressed_tag=btn_on) self.sprite_loader.load("data_lt2/ani/system/btn/?/yes.arc", self.hint_unlock, sprite_sheet=True) self.hint_no_unlock = pge.Button( position=[80, 40], center=[pge.Alignment.RIGHT, pge.Alignment.TOP], not_pressed_tag=btn_off, pressed_tag=btn_on) self.sprite_loader.load("data_lt2/ani/system/btn/?/no.arc", self.hint_no_unlock, sprite_sheet=True) self.hint_text = pge.Text( position=[-256 // 2 + 20, -192 // 2 + 42], center=[pge.Alignment.LEFT, pge.Alignment.TOP], color=pg.Color(0, 0, 0)) self.font_loader.load("fontq", 10, self.hint_text) self.hint_selected: List[pge.Button] = [] current_x = -256 // 2 + 8 for i in range(3): hint_select = pge.Button( position=[current_x, -192 // 2 + 4], center=[pge.Alignment.LEFT, pge.Alignment.TOP], not_pressed_tag="OFF", pressed_tag="ON") hint_select.visible = False self.sprite_loader.load( f"data_lt2/ani/nazo/system/?/hint{i + 1}.arc", hint_select, sprite_sheet=True) current_x += hint_select.get_world_rect().w + 1 self.hint_selected.append(hint_select) self.view_hint(self.progress_hints(set_hint=0)) smd, presets = load_smd("data_lt2/sound/BG_035.SMD") self.puzzle_bg_music = SMDLStreamPlayer() self.puzzle_bg_music.set_preset_dict(presets) self.puzzle_bg_music.start_sound(smd, loops=-1)