def demo(screen): effects = [ Print(screen, Plasma(screen.height, screen.width, screen.colours), 0, speed=3, transparent=False), ] screen.play([Scene(effects, 500)])
def _plasma(screen): return [ Print( screen, Plasma(screen.height, screen.width, screen.colours), 0, speed=1, transparent=False, ) ]
def __init__(self, screen): self._screen = screen effects = [ Print(screen, Plasma(screen.height, screen.width, screen.colours), 0, speed=1, transparent=False), ] super(PlasmaScene, self).__init__(effects, 200, clear=False)
def plasma(screen: Screen) -> List[Print]: return [ Print( screen, Plasma(screen.height, screen.width, screen.colours), 0, speed=1, transparent=False, ) ]
def test_plasma(self): """ Check that the Plasma renderer works. """ # Check basic content of the renderer renderer = Plasma(5, 10, 8) # Check several renderings for _ in range(10): output = renderer.rendered_text for char in "\n".join(output[0]): self.assertIn(char, ' .:;rsA23hHG#9&@\n') # Check dimensions self.assertEqual(renderer.max_height, 5) self.assertEqual(renderer.max_width, 10)
def reset(self, old_scene=None, screen=None): effects = [ # Stars(screen, (screen.width + screen.height) // 2, start_frame=0), Print(self._screen, Plasma(self._screen.height, self._screen.width, self._screen.colours), x=0, y=0, speed=10, start_frame=0, stop_frame=110, transparent=False), Print( self._screen, # Rainbow(self._screen, FigletText( "You found something, the memories are coming back.", font='thin', width=self._screen.width)), # noqa: E501 FigletText( "You found something, the memories are coming back.", font='thin', width=self._screen.width), x=2, y=16, clear=False, transparent=True, start_frame=0, stop_frame=110), DropScreen(self._screen, 100, start_frame=100), Print(self._screen, Rainbow( self._screen, FigletText("Tom is alive...", font='standard', width=self._screen.width)), x=20, y=16, clear=True, start_frame=150, stop_frame=self.duration), ] for fx in effects: self.add_effect(fx)
def __init__(self, screen, game): fonts = [ "slant", "poison", "sblood", "banner", "banner3", # "standard", "univers" ] font = choice(fonts) you_text = FigletText("YOU", font=font) lost_text = FigletText("LOST", font=font) continue_text = FigletText("Press any key to continue", font="term") self._screen = screen effects = [ Print(screen, Plasma(screen.height, screen.width, screen.colours), 0, speed=1, transparent=False), ] effects.append(Print(screen, continue_text, screen.height - 3, 5, speed=1 ) ) effects.append(Print(screen, you_text, (screen.height // 4) - you_text.max_height // 2, (screen.width - you_text.max_width) // 2 + 1, colour=Screen.COLOUR_BLACK, start_frame=seconds_to_frame(2), speed=1) ) effects.append(Print(screen, you_text, (screen.height // 4) - you_text.max_height // 2, (screen.width - you_text.max_width) // 2, start_frame=seconds_to_frame(2), speed=1) ) effects.append(Print(screen, lost_text, ((screen.height // 4) * 2) - lost_text.max_height // 2, (screen.width - lost_text.max_width) // 2 + 1, colour=Screen.COLOUR_BLACK, start_frame=seconds_to_frame(3), speed=1) ) effects.append(Print(screen, lost_text, ((screen.height // 4) * 2) - lost_text.max_height // 2, (screen.width - lost_text.max_width) // 2, start_frame=seconds_to_frame(3), speed=1) ) super(PlasmaScene, self).__init__(effects, 200, clear=False)