예제 #1
0
    def reset(self, old_scene=None, screen=None):
        centre = (self._screen.width // 2, self._screen.height // 2)
        text = Figlet(font="banner", width=200).renderText("ChafNut Games")
        width = max([len(x) for x in text.split("\n")])

        effects = [
            Print(self._screen,
                  Fire(20, width, text, .4, 40, self._screen.colours),
                  x=centre[0] - 40,
                  y=centre[1] - 30,
                  speed=1,
                  transparent=False),
            Print(self._screen,
                  FigletText("ChafNut Games", "banner"),
                  x=centre[0] - 40,
                  y=centre[1] - 12,
                  colour=Screen.COLOUR_WHITE,
                  bg=Screen.COLOUR_WHITE,
                  speed=1),
            Print(self._screen,
                  FigletText("Michael Robinson \n Matt Mulhern", "thin"),
                  x=centre[0] - 20,
                  y=centre[1],
                  colour=Screen.COLOUR_WHITE,
                  bg=Screen.COLOUR_BLACK,
                  speed=1)
        ]

        for fx in effects:
            self.add_effect(fx)
예제 #2
0
def demo(screen):
    effects = [
        Cycle(screen, FigletText("P Y T H O N", font='big'),
              screen.height // 2 - 8),
        Cycle(screen, Fire(screen.height, screen.width, 'O', 0.5, 50, 5),
              screen.height // 2 + 3),
        Snow(screen),
        Mirage(screen, FigletText("R O C K S ! ! !"), screen.height // 2 + 3,
               2)
    ]
    screen.play([Scene(effects, 500)])
예제 #3
0
    def test_fire(self):
        """
        Check that the Fire renderer works.
        """
        # Allow the fire to burn for a bit...
        renderer = Fire(5, 10, "xxxxxxxx", 1.0, 20, 8)
        output = None
        for _ in range(100):
            output = renderer.rendered_text

        # Output should be something like this, but we can't check exactly due
        # to the random nature of the effect and the difference in RNG between
        # Python2 and Python3.
        #
        #    "  .:...   \n" +
        #    "  .::.    \n" +
        #    " .:$$::.. \n" +
        #    "..::$$$$. \n" +
        #    " ..:$&&:  "
        for char in "\n".join(output[0]):
            self.assertIn(char, " .:$&@\n")

        # Check dimensions
        self.assertEqual(renderer.max_height, 5)
        self.assertEqual(renderer.max_width, 10)

        # Check multi-line seeds work too...
        renderer = Fire(5, 10, "xxxx\nxxxx\nxxxx", 1.0, 20, 8)
        for _ in range(100):
            output = renderer.rendered_text
        for char in "\n".join(output[0]):
            self.assertIn(char, " .:$&@\n")

        # Check BG flag renders to BG colours only...
        renderer = Fire(5, 10, "xxxx\nxxxx\nxxxx", 1.0, 20, 8, bg=True)
        for _ in range(100):
            output = renderer.rendered_text
        for char in "\n".join(output[0]):
            self.assertIn(char, " \n")
예제 #4
0
    def wait_screen(self):
        def input_event_handler(event):
            if isinstance(event, KeyboardEvent):
                c = event.key_code
                self.sm.step(c)
                if c is ord(" "):
                    raise StopApplication("Screen stopped by user")

        # self.mGPU.setCurrentScreen(screen)
        effects = [
            Print(self.mGPU.screen,
                  FigletText("DIFFICULTY:   {}".format(
                      self.sm.state["DIFFICULTY"]),
                             font='small'),
                  y=self.mGPU.height // 2 - 10),
            Print(self.mGPU.screen,
                  Fire(10, self.mGPU.width, "*" * self.mGPU.width, 1, 30,
                       self.mGPU.screen.colours, False),
                  y=self.mGPU.height - 5,
                  speed=1,
                  transparent=True),
            Print(self.mGPU.screen,
                  StaticRenderer(images=[
                      r"""
_______________________________________________________________________________________
| OBJECTIVE                                                                            |
|--------------------------------------------------------------------------------------|
|                                                                                      |
|  You need to escape the maze ASAP. Find the ${1}RED${7} door!                                |
|  You are only allowed to look at the map for a limited number of times.              |
|                                                                                      |
|                                                                                      |
|  control : Press A, W, S, D to move around. Press Q and E to pan.                    |
|  Press M to look at the map (Psst you only can look at the map limited no. of time)  |
|  Press P to pause the game. (It can be tiring so take your time to solve the maze)   |
|                                                                                      |
|  Are you ready?  \☺/                                                                 |
|  Good luck!       []                                                                 |
|                   /\                        ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄      |
|                                             █        ▀█▄▀▄▀██████ ▀█▄▀▄▀██████       |
|  Press [SPACE BAR] to start the game                   ▀█▄█▄███▀    ▀█▄█▄███         |
|______________________________________________________________________________________|
            """
                  ]),
                  y=self.mGPU.height // 2 - 5)
        ]

        self.mGPU.set_title("Maze Runner")
        self.mGPU.playScene(effects,
                            stop_on_resize=True,
                            input_handler=input_event_handler)
예제 #5
0
def game_over(screen):
    scenes = []

    effects = [
        Print(
            screen,
            Fire(
                screen.height,
                80,
                "*" * 70,
                0.8,
                60,
                screen.colours,
                bg=screen.colours >= 256,
            ),
            0,
            speed=1,
            transparent=False,
        ),
        Print(
            screen,
            FigletText("\nGame", "banner3"),
            (screen.height - 4) // 2,
            colour=Screen.COLOUR_BLACK,
            speed=1,
            start_frame=30,
            stop_frame=50,
        ),
        Print(
            screen,
            FigletText("\nOver", "banner3"),
            (screen.height - 4) // 2,
            colour=Screen.COLOUR_BLACK,
            speed=1,
            start_frame=50,
            stop_frame=70,
        ),
        Print(
            screen,
            FigletText("BWA\n  HA\n HA\nHA!!!", "banner3"),
            (screen.height - 4) // 2,
            colour=Screen.COLOUR_BLACK,
            speed=1,
            start_frame=70,
        ),
    ]
    scenes.append(Scene(effects, 100))

    screen.play(scenes, stop_on_resize=True, repeat=False)
예제 #6
0
def yule_log(screen):
    screen_height = screen.height
    screen_width = screen.width
    log_x = (screen_width // 2) - HALF_LOG_LENGTH
    log_y = (screen_height // 2) + HALF_LOG_HEIGHT
    if screen_height < 30:
        log_y = screen_height // 3
    elif screen_height < 48:
        log_y = screen_height // 2

    scenes = []

    effects = [
        Snow(screen),
        Print(screen,
              Fire(screen.height - 10,
                   80,
                   "*" * 70,
                   0.8,
                   60,
                   screen.colours,
                   bg=screen.colours >= 256),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              StaticRenderer(images=YULE_LOG),
              x=log_x,
              y=log_y,
              colour=1,
              speed=1,
              transparent=True),
    ]
    if screen_height > 40:
        effects += [
            Print(screen,
                  FigletText("MERRY", font='univers'),
                  1,
                  speed=1,
                  start_frame=5),
            Print(screen,
                  FigletText("CHRISTMAS!", font='univers'),
                  10,
                  speed=1,
                  start_frame=15),
        ]

    scenes.append(Scene(effects, -1))
    screen.play(scenes, stop_on_resize=True)
예제 #7
0
파일: Fire.py 프로젝트: CybernetiX-S3C/Fire
def flames(screen):
    scenes = []

    effects = [
        Print(screen,
              Fire(screen.height, 80, "*" * 70, 0.8, 60, screen.colours,
                   bg=screen.colours >= 256),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("JPM", "banner3"),
              (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1)
    ]
    scenes.append(Scene(effects))

    screen.play(scenes, stop_on_resize=True, repeat=False)
def flames_cpu_screen(screen):
    scenes = []

    effects = [
        Print(screen,
              Fire(screen.height,
                   80,
                   "*" * 70,
                   0.8,
                   60,
                   screen.colours,
                   bg=screen.colours >= 256),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("OMG!", "banner3"), (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              stop_frame=30),
        Print(screen,
              FigletText("THE CPU", "banner3"), (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=30,
              stop_frame=50),
        Print(screen,
              FigletText("IS", "banner3"), (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=50,
              stop_frame=70),
        Print(screen,
              FigletText("ON FIRE!", "banner3"), (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=70),
    ]
    scenes.append(Scene(effects, 100))
    screen.play(scenes, stop_on_resize=True, repeat=False)
def demo(screen):
    scenes = []

    effects = [
        Print(screen,
              Fire(screen.height,
                   80,
                   "*" * 70,
                   0.8,
                   60,
                   screen.colours,
                   bg=screen.colours >= 256),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("Help!", "banner3"), (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              stop_frame=30),
        Print(screen,
              FigletText("I'm", "banner3"), (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=30,
              stop_frame=50),
        Print(screen,
              FigletText("on", "banner3"), (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=50,
              stop_frame=70),
        Print(screen,
              FigletText("Fire!", "banner3"), (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=70),
    ]
    scenes.append(Scene(effects, 100))
    screen.play(scenes, stop_on_resize=True)
예제 #10
0
파일: thanks.py 프로젝트: chafgames/writer
    def reset(self, old_scene=None, screen=None):
        centre = (self._screen.width // 2, self._screen.height // 2)
        text = Figlet(font="banner", width=200).renderText("Special Thanks")
        width = max([len(x) for x in text.split("\n")])

        effects = [
            Print(self._screen,
                  Fire(20, width, text, .4, 40, self._screen.colours),
                  x=centre[0] - 40,
                  y=centre[1] - 30,
                  speed=1,
                  transparent=False),
            Print(self._screen,
                  FigletText("Special Thanks", "banner"),
                  x=centre[0] - 40,
                  y=centre[1] - 12,
                  colour=Screen.COLOUR_WHITE,
                  bg=Screen.COLOUR_WHITE,
                  speed=1),
            Print(self._screen,
                  FigletText(
                      "@peterbrittain\n(github.com/peterbrittain/asciimatics)",
                      "thin"),
                  x=1,
                  y=centre[1] - 4,
                  colour=Screen.COLOUR_WHITE,
                  bg=Screen.COLOUR_BLACK,
                  speed=1),
            Print(self._screen,
                  FigletText("Chris Black\n(Head Writer)", "thin"),
                  x=1,
                  y=centre[1] + 11,
                  colour=Screen.COLOUR_WHITE,
                  bg=Screen.COLOUR_BLACK,
                  speed=1)
        ]

        for fx in effects:
            self.add_effect(fx)
예제 #11
0
def _credits(screen):
    scenes = []

    text = Figlet(font="banner", width=200).renderText("ASCIIMATICS")
    width = max([len(x) for x in text.split("\n")])

    effects = [
        Print(screen,
              Fire(screen.height, 80, text, 0.4, 40, screen.colours),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              x=(screen.width - width) // 2 + 1,
              colour=Screen.COLOUR_BLACK,
              bg=Screen.COLOUR_BLACK,
              speed=1),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1),
    ]
    scenes.append(Scene(effects, 100))

    effects = [
        Matrix(screen, stop_frame=200),
        Mirage(screen,
               FigletText("Asciimatics"),
               screen.height // 2 - 3,
               Screen.COLOUR_GREEN,
               start_frame=100,
               stop_frame=200),
        Wipe(screen, start_frame=150),
        Cycle(screen,
              FigletText("Asciimatics"),
              screen.height // 2 - 3,
              start_frame=200)
    ]
    scenes.append(Scene(effects, 250, clear=False))

    effects = [
        BannerText(
            screen,
            Rainbow(
                screen,
                FigletText("Reliving the 80s in glorious ASCII text...",
                           font='slant')), screen.height // 2 - 3,
            Screen.COLOUR_GREEN)
    ]
    scenes.append(Scene(effects))

    effects = [
        Scroll(screen, 3),
        Mirage(screen, FigletText("Conceived and"), screen.height,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("written by:"), screen.height + 8,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Peter Brittain"), screen.height + 16,
               Screen.COLOUR_GREEN)
    ]
    scenes.append(Scene(effects, (screen.height + 24) * 3))

    colours = [
        Screen.COLOUR_RED,
        Screen.COLOUR_GREEN,
    ]
    contributors = [
        "Cory Benfield", "Bryce Guinta", "Aman Orazaev", "Daniel Kerr",
        "Dylan Janeke", "ianadeem", "Scott Mudge", "Luke Murphy", "mronkain",
        "Dougal Sutherland", "Kirtan Sakariya", "Jesse Lieberg",
        "Erik Doffagne", "Noah Ginsburg", "Davidy22", "Christopher Trudeau",
        "Beniamin Kalinowski"
    ]

    effects = [
        Scroll(screen, 3),
        Mirage(
            screen,
            FigletText("With help from:"),
            screen.height,
            Screen.COLOUR_GREEN,
        )
    ]

    pos = 8
    for i, name in enumerate(contributors):
        effects.append(
            Mirage(
                screen,
                FigletText(name),
                screen.height + pos,
                colours[i % len(colours)],
            ))

        pos += 8
    scenes.append(Scene(effects, (screen.height + pos) * 3))

    effects = [
        Cycle(screen,
              FigletText("ASCIIMATICS", font='big'),
              screen.height // 2 - 8,
              stop_frame=100),
        Cycle(screen,
              FigletText("ROCKS!", font='big'),
              screen.height // 2 + 3,
              stop_frame=100),
        Stars(screen, (screen.width + screen.height) // 2, stop_frame=100),
        DropScreen(screen, 200, start_frame=100)
    ]
    scenes.append(Scene(effects, 300))

    effects = [
        Print(screen,
              SpeechBubble("Press 'X' to exit."),
              screen.height // 2 - 1,
              attr=Screen.A_BOLD)
    ]
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)
예제 #12
0
def demo(screen):
    scenes = []
    effects = (
        Cycle(screen=screen,
              renderer=Fire(height=100,
                            width=100,
                            emitter='X',
                            intensity=0.5,
                            spot=5,
                            colours=5),
              y=int(screen.height / 2 - 8)),
        Cycle(screen=screen,
              renderer=FigletText('ACM @ Miami University'),
              y=int(screen.height / 2 - 6)),
        Cycle(screen=screen,
              renderer=FigletText('ROCKS!', font='big'),
              y=int(screen.height / 2 + 3)),
        Stars(screen=screen, count=200),
    )
    scenes.append(Scene(effects, duration=50))

    effects = (
        Print(screen=screen,
              renderer=Fire(screen.height,
                            80,
                            '*' * 70,
                            0.8,
                            60,
                            screen.colours,
                            bg=screen.colours >= 256),
              y=0,
              speed=1,
              transparent=False),
        Print(screen=screen,
              renderer=FigletText('Python', font='banner3'),
              y=(screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=30,
              stop_frame=50),
        Print(screen=screen,
              renderer=FigletText('is', font='banner3'),
              y=(screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=50,
              stop_frame=70),
        Print(screen=screen,
              renderer=FigletText('Awesome!', font='banner3'),
              y=(screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=70),
    )
    scenes.append(Scene(effects, duration=100))

    effects = [Stars(screen, screen.width)]
    for _ in range(20):
        fireworks = [
            (PalmFirework, 25, 30),
            (PalmFirework, 25, 30),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (RingFirework, 20, 30),
            (SerpentFirework, 30, 35),
        ]
        firework, start, stop = choice(fireworks)
        effects.append(
            firework(screen,
                     randint(0, screen.width),
                     randint(screen.height // 8, screen.height * 3 // 4),
                     randint(start, stop),
                     start_frame=randint(0, 250)))

    effects.append(
        Print(screen,
              Rainbow(screen, FigletText("Join our")),
              screen.height // 2 - 6,
              speed=1,
              start_frame=100))
    effects.append(
        Print(screen,
              Rainbow(screen, FigletText("club!")),
              screen.height // 2 + 1,
              speed=1,
              start_frame=100))
    scenes.append(Scene(effects, duration=150))

    screen.play(scenes, repeat=True)
예제 #13
0
def demo(screen):
    scenes = []

    effects = [
        Print(screen,
              Fire(screen.height, 80, "*" * 70, 0.8, 60, screen.colours,
                   bg=screen.colours >= 256),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("Help!", "banner3"),
              (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              stop_frame=30),
        Print(screen,
              FigletText("I'm", "banner3"),
              (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=30,
              stop_frame=50),
        Print(screen,
              FigletText("on", "banner3"),
              (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=50,
              stop_frame=70),
        Print(screen,
              FigletText("Fire!", "banner3"),
              (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=70),
    ]
    scenes.append(Scene(effects, 100))

    text = Figlet(font="banner", width=200).renderText("ASCIIMATICS")
    width = max([len(x) for x in text.split("\n")])

    effects = [
        Print(screen,
              Fire(screen.height, 80, text, 0.4, 40, screen.colours),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9, x=(screen.width - width) // 2 + 1,
              colour=Screen.COLOUR_BLACK,
              bg=Screen.COLOUR_BLACK,
              speed=1),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1),
    ]
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)
예제 #14
0
def _credits(screen):
    scenes = []

    text = Figlet(font="banner", width=200).renderText("ASCIIMATICS")
    width = max([len(x) for x in text.split("\n")])

    effects = [
        Print(screen,
              Fire(screen.height, 80, text, 0.4, 40, screen.colours),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              x=(screen.width - width) // 2 + 1,
              colour=Screen.COLOUR_BLACK,
              bg=Screen.COLOUR_BLACK,
              speed=1),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1),
    ]
    scenes.append(Scene(effects, 100))

    effects = [
        Matrix(screen, stop_frame=200),
        Mirage(screen,
               FigletText("Asciimatics"),
               screen.height // 2 - 3,
               Screen.COLOUR_GREEN,
               start_frame=100,
               stop_frame=200),
        Wipe(screen, start_frame=150),
        Cycle(screen,
              FigletText("Asciimatics"),
              screen.height // 2 - 3,
              start_frame=200)
    ]
    scenes.append(Scene(effects, 250, clear=False))

    effects = [
        BannerText(
            screen,
            Rainbow(
                screen,
                FigletText("Reliving the 80s in glorious ASCII text...",
                           font='slant')), screen.height // 2 - 3,
            Screen.COLOUR_GREEN)
    ]
    scenes.append(Scene(effects))

    effects = [
        Mirage(screen, FigletText("Conceived and"), screen.height,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("written by:"), screen.height + 8,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Peter Brittain"), screen.height + 16,
               Screen.COLOUR_GREEN),
        Scroll(screen, 3)
    ]
    scenes.append(Scene(effects, (screen.height + 24) * 3))

    effects = [
        Mirage(screen, FigletText("With help from:"), screen.height,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Cory Benfield"), screen.height + 8,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Bryce Guinta"), screen.height + 16,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Aman Orazaev"), screen.height + 24,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Daniel Kerr"), screen.height + 32,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Dylan Janeke"), screen.height + 40,
               Screen.COLOUR_GREEN),
        Scroll(screen, 3)
    ]
    scenes.append(Scene(effects, (screen.height + 48) * 3))

    effects = [
        Cycle(screen,
              FigletText("ASCIIMATICS", font='big'),
              screen.height // 2 - 8,
              stop_frame=100),
        Cycle(screen,
              FigletText("ROCKS!", font='big'),
              screen.height // 2 + 3,
              stop_frame=100),
        Stars(screen, (screen.width + screen.height) // 2, stop_frame=100),
        DropScreen(screen, 100, start_frame=100)
    ]
    scenes.append(Scene(effects, 200))

    effects = [
        Print(screen,
              SpeechBubble("Press 'X' to exit."),
              screen.height // 2 - 1,
              attr=Screen.A_BOLD)
    ]
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)
예제 #15
0
    def start_screen(self):
        # set up the event handler function
        def input_event_handler(event):
            """
            Default unhandled event handler for handling simple scene navigation.
            """
            if isinstance(event, KeyboardEvent):
                c = event.key_code
                self.sm.step(c)
                if c in (ord("E"), ord("e"), ord("H"), ord("h"), ord("Q"),
                         ord("q")):
                    raise StopApplication("Screen stopped by user")

        effects = [
            Print(self.mGPU.screen,
                  FigletText("MAZE  RUNNER", font='big'),
                  y=self.mGPU.height // 2 - 12),
            Print(self.mGPU.screen,
                  Fire(10, self.mGPU.width, "*" * self.mGPU.width, 1, 30,
                       self.mGPU.screen.colours, False),
                  y=self.mGPU.height - 5,
                  speed=1,
                  transparent=True),
            Print(
                self.mGPU.screen,
                StaticRenderer(
                    images=[r"Press [E] for EASY mode or [H] for HARD mode."]),
                y=self.mGPU.height // 2 - 3 - 1),
            Print(self.mGPU.screen,
                  StaticRenderer(images=[r"Press [Q] to quit."]),
                  y=self.mGPU.height // 2 - 3),
            Print(self.mGPU.screen,
                  StaticRenderer(images=[
                      r"""
         ▀▀▀██████▄▄▄
      ▄▄▄▄▄  █████████▄
     ▀▀▀▀█████▌ ▀▐▄ ▀▐█
   ▀▀█████▄▄ ▀██████▄██
   ▀▄▄▄▄▄  ▀▀█▄▀█════█▀
        ▀▀▀▄  ▀▀███ ▀      ▄▄
     ▄███▀▀██▄████████▄ ▄▀▀▀██▌
   ██▀▄▄▄██▀▄███▀ ▀▀████     ▀█▄
▄▀▀▀▄██▄▀▀▌████▒▒▒▒▒▒███    ▌▄▄▀
▌    ▐▀████▐███▒▒▒▒▒▐██▌
▀▄  ▄▀   ▀▀████▒▒▒▒▄██▀
  ▀▀      ▀▀█████████▀
        ▄▄██▀██████▀█
      ▄██▀     ▀▀▀  █
     ▄█             ▐▌
 ▄▄▄▄█▌              ▀█▄▄▄▄▀▀▄
▌     ▐                ▀▀▄▄▄▀
▀▀▀▀▀▀▀
    """
                  ]),
                  y=self.mGPU.height // 2)
            #                 Print(screen,
            #                       StaticRenderer(images=[r"""
            #       ${3,1}*
            #      / \
            #     /${1}o${2}  \
            #    /_   _\
            #     /   \${4}b
            #    /     \
            #   /   ${1}o${2}   \
            #  /__     __\
            #  ${1}d${2} / ${4}o${2}   \
            #   /       \
            #  / ${4}o     ${1}o${2}.\
            # /___________\
            #      ${3}|||
            #      ${3}|||
            #     """]), y=self.mGPU.height//2 + 3)
        ]

        self.mGPU.set_title("Maze Runner")
        self.mGPU.playScene(effects,
                            stop_on_resize=True,
                            input_handler=input_event_handler)
예제 #16
0
def play(_screen):
    global screen

    screen = _screen
    spacerect = " " * (ARENA_DIMMS[0] - 2) + "\n"
    spacerect *= ARENA_DIMMS[1] - 2

    effects = [
        Stars(screen, (screen.width + screen.height) // 2 + 45,
              delete_count=1),
        # Blackout
        Print(
            screen,
            renderer=StaticRenderer(images=[spacerect]),
            colour=Screen.COLOUR_BLACK,
            x=GLOBALOFFSETS[0] + 1,
            y=GLOBALOFFSETS[1] + 1,
            transparent=False,
            delete_count=1,
        ),
        # Print(screen, renderer=Plasma(screen.height, screen.width, 8), y=0),
        # frame update
        Print(screen,
              renderer=UpdateFrame(0, 0),
              colour=Screen.COLOUR_RED,
              y=0),
        # Arena geo
        Print(
            screen,
            renderer=Box(ARENA_DIMMS[0], ARENA_DIMMS[1], uni=True),
            y=GLOBALOFFSETS[1],
            x=GLOBALOFFSETS[0],
        ),
        Print(
            screen,
            renderer=GeometryRenderer(),
            colour=Screen.COLOUR_WHITE,
            x=GLOBALOFFSETS[0] + 4,
            y=GLOBALOFFSETS[1] + 14,
        ),
        # clock
        Print(
            screen,
            renderer=ClockText(),
            colour=Screen.COLOUR_CYAN,
            x=GLOBALOFFSETS[0] + 38,
            y=GLOBALOFFSETS[1],
            transparent=False,
        ),
        # scores
        Print(
            screen,
            renderer=ScoreText(TEAM_ORANGE),
            colour=Screen.COLOUR_RED,
            x=GLOBALOFFSETS[0] - 14,
            y=GLOBALOFFSETS[1],
            speed=20,
            transparent=False,
        ),
        Print(
            screen,
            renderer=ScoreText(TEAM_BLUE),
            colour=Screen.COLOUR_BLUE,
            x=GLOBALOFFSETS[0] + ARENA_DIMMS[0] + 1,
            y=GLOBALOFFSETS[1],
            speed=20,
            transparent=False,
        ),
        # disc sprite
        Sprite(
            screen,
            {"default": StaticRenderer(images=["()"])},
            path=DiscPath(screen, 5, 5),
            colour=Screen.COLOUR_GREEN,
        ),
        # players
        Sprite(
            screen,
            {"default": StaticRenderer(images=["•"])},
            path=PlayerPath(screen, 5, 5, TEAM_BLUE, 0),
            colour=Screen.COLOUR_BLUE,
        ),
        Print(
            screen,
            renderer=PlayerNameText(TEAM_BLUE, 0),
            colour=Screen.COLOUR_BLUE,
            x=GLOBALOFFSETS[0] + ARENA_DIMMS[0] + 1,
            y=GLOBALOFFSETS[1] + 24,
            speed=20,
            transparent=False,
        ),
        Sprite(
            screen,
            {"default": StaticRenderer(images=["•"])},
            path=PlayerPath(screen, 5, 5, TEAM_BLUE, 1),
            colour=Screen.COLOUR_BLUE,
        ),
        Print(
            screen,
            renderer=PlayerNameText(TEAM_BLUE, 1),
            colour=Screen.COLOUR_BLUE,
            x=GLOBALOFFSETS[0] + ARENA_DIMMS[0] + 1,
            y=GLOBALOFFSETS[1] + 26,
            speed=20,
            transparent=False,
        ),
        Sprite(
            screen,
            {"default": StaticRenderer(images=["•"])},
            path=PlayerPath(screen, 5, 5, TEAM_BLUE, 2),
            colour=Screen.COLOUR_BLUE,
        ),
        Print(
            screen,
            renderer=PlayerNameText(TEAM_BLUE, 2),
            colour=Screen.COLOUR_BLUE,
            x=GLOBALOFFSETS[0] + ARENA_DIMMS[0] + 1,
            y=GLOBALOFFSETS[1] + 28,
            speed=20,
            transparent=False,
        ),
        Sprite(
            screen,
            {"default": StaticRenderer(images=["•"])},
            path=PlayerPath(screen, 5, 5, TEAM_BLUE, 3),
            colour=Screen.COLOUR_BLUE,
        ),
        Print(
            screen,
            renderer=PlayerNameText(TEAM_BLUE, 3),
            colour=Screen.COLOUR_BLUE,
            x=GLOBALOFFSETS[0] + ARENA_DIMMS[0] + 1,
            y=GLOBALOFFSETS[1] + 30,
            speed=20,
            transparent=False,
        ),
        Sprite(
            screen,
            {"default": StaticRenderer(images=["•"])},
            path=PlayerPath(screen, 5, 5, TEAM_ORANGE, 0),
            colour=Screen.COLOUR_RED,
        ),
        Print(
            screen,
            renderer=PlayerNameText(TEAM_ORANGE, 0),
            colour=Screen.COLOUR_RED,
            y=GLOBALOFFSETS[1] + 24,
            x=GLOBALOFFSETS[0] - 17,
            speed=20,
            transparent=False,
        ),
        Sprite(
            screen,
            {"default": StaticRenderer(images=["•"])},
            path=PlayerPath(screen, 5, 5, TEAM_ORANGE, 1),
            colour=Screen.COLOUR_RED,
        ),
        Print(
            screen,
            renderer=PlayerNameText(TEAM_ORANGE, 1),
            colour=Screen.COLOUR_RED,
            x=GLOBALOFFSETS[0] - 17,
            y=GLOBALOFFSETS[1] + 26,
            speed=20,
            transparent=False,
        ),
        Sprite(
            screen,
            {"default": StaticRenderer(images=["•"])},
            path=PlayerPath(screen, 5, 5, TEAM_ORANGE, 2),
            colour=Screen.COLOUR_RED,
        ),
        Print(
            screen,
            renderer=PlayerNameText(TEAM_ORANGE, 2),
            colour=Screen.COLOUR_RED,
            x=GLOBALOFFSETS[0] - 17,
            y=GLOBALOFFSETS[1] + 28,
            speed=20,
            transparent=False,
        ),
        Sprite(
            screen,
            {"default": StaticRenderer(images=["•"])},
            path=PlayerPath(screen, 5, 5, TEAM_ORANGE, 3),
            colour=Screen.COLOUR_RED,
        ),
        Print(
            screen,
            renderer=PlayerNameText(TEAM_ORANGE, 3),
            colour=Screen.COLOUR_RED,
            x=GLOBALOFFSETS[0] - 17,
            y=GLOBALOFFSETS[1] + 30,
            speed=20,
            transparent=False,
        ),
        # Hotness
        Print(
            screen,
            renderer=Fire(8, 125, "*" * 110, 0.8, 20, screen.colours),
            y=GLOBALOFFSETS[1] + ARENA_DIMMS[1],
            x=0,
        ),
        # Title
        Print(
            screen,
            renderer=FigletText("Echo Arena", font="big"),
            y=GLOBALOFFSETS[1] + ARENA_DIMMS[1],
            x=GLOBALOFFSETS[0] + 9,
        ),
        Print(
            screen,
            renderer=StaticRenderer(images=["by qlyoung"]),
            colour=Screen.COLOUR_YELLOW,
            y=GLOBALOFFSETS[1] + ARENA_DIMMS[1],
            x=GLOBALOFFSETS[0] + 50,
        ),
    ]

    scenes["main"] = Scene(effects, -1, clear=True)

    screen.play([scenes["main"]])
    sleep(10)
예제 #17
0
from asciimatics.effects import Cycle, Stars
from asciimatics.renderers import FigletText
from asciimatics.scene import Scene
from asciimatics.screen import Screen
from asciimatics.renderers import BarChart, SpeechBubble, Rainbow, Fire

print(FigletText("ROCKS!", font='big'))

f = lambda: 2
f1 = lambda: 12

print(Fire(10, 10, 'raustienrastui enrstuaie rstuaien', 0.5, 2, 3, bg=False))

import time
from tqdm import tqdm

for i in tqdm(range(12)):
    time.sleep(0.1)