Exemplo n.º 1
0
    def draw(self):
        time.sleep(.5)
        gameDisplay.fill(black)
        choose = True
        self.draw_count += 1
        if self.draw_count == 5:
            self.war_games()
        else:
            while choose:
                for event in p.event.get():
                    if event.type == p.QUIT:
                        p.quit()
                        quit()

                large_text = p.font.SysFont("comicsansms", 50)
                text_surf, text_rect = __main__.text_objects(
                    "The Game was a Draw", large_text, white)
                text_rect.center = ((width_display / 2),
                                    (height_display * (1 / 4)))
                gameDisplay.blit(text_surf, text_rect)
                __main__.button("REMATCH!", white,
                                (width_display * (1 / 3)) - 100,
                                height_display / 2, 150, 100, dark_green,
                                green, 25, self.reset)
                __main__.button("QUIT!", white, (width_display * (2 / 3)) - 50,
                                height_display / 2, 150, 100, dark_red, red,
                                25, __main__.quit_game)

                clock.tick(15)
                p.display.update()
Exemplo n.º 2
0
    def loser(self):
        time.sleep(.5)
        gameDisplay.fill(black)
        self.lose_count += 1
        choose = True
        while choose:
            for event in p.event.get():
                if event.type == p.QUIT:
                    p.quit()
                    quit()

            large_text = p.font.SysFont("comicsansms", 60)
            text_surf, text_rect = __main__.text_objects(
                "AI is the Winner!", large_text, white)
            text_rect.center = ((width_display / 2),
                                (height_display * (1 / 4)))
            gameDisplay.blit(text_surf, text_rect)
            __main__.button("REMATCH!", white, (width_display - 100) * (1 / 4),
                            height_display / 2, 150, 100, dark_green, green,
                            25, self.reset)
            __main__.button("QUIT!", white, (width_display - 100) * (3 / 4),
                            height_display / 2, 150, 100, dark_red, red, 25,
                            __main__.quit_game)

            clock.tick(15)
            p.display.update()
Exemplo n.º 3
0
 def set_up(self):
     __main__.button("", black, 600, 20, 180, 560, black, black, 25, None)
     win1 = [("Win:"), 80]
     win2 = [(str(self.win_count)), 160]
     draw1 = [("Draw:"), 240]
     draw2 = [(str(self.draw_count)), 320]
     lose1 = [("Lose:"), 400]
     lose2 = [(str(self.lose_count)), 480]
     for i in [win1, win2, draw1, draw2, lose1, lose2]:
         x = 680
         y = i[1]
         i.pop(1)
         i = ''.join(i)
         large_text = p.font.SysFont("comicsansms", 50)
         text_surf, text_rect = __main__.text_objects(i, large_text, white)
         text_rect.center = (x, y)
         gameDisplay.blit(text_surf, text_rect)
     p.display.update()
     self.button_grid()
Exemplo n.º 4
0
def choose_piece():
    time.sleep(.2)
    choose = True
    while choose:
        for event in p.event.get():
            if event.type == p.QUIT:
                p.quit()
                quit()

        gameDisplay.fill(white)
        large_text = p.font.SysFont("comicsansms", 90)
        text_surf, text_rect = __main__.text_objects("Which Team", large_text,
                                                     black)
        text_rect.center = ((width_display / 2), (height_display * (1 / 4)))
        gameDisplay.blit(text_surf, text_rect)
        __main__.button("X", black, (width_display * (1 / 3)) - 100,
                        height_display / 2, 150, 100, dark_blue, blue, 45,
                        grid.set_x)
        __main__.button("O", black, (width_display * (2 / 3)) - 50,
                        height_display / 2, 150, 100, dark_pink, pink, 45,
                        grid.set_o)

        clock.tick(15)
        p.display.update()