From 27a3bc0b921419dbbbd7623bf9f0a2b0b6e78d7c Mon Sep 17 00:00:00 2001 From: IljaP Date: Fri, 26 Apr 2024 08:36:34 +0300 Subject: [PATCH] Main upadate --- main.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/main.py b/main.py index cf45068..5dfadf1 100644 --- a/main.py +++ b/main.py @@ -15,6 +15,9 @@ from pygame.locals import ( pygame.init() +pygame.font.init() +my_font = pygame.font.SysFont('Calibri (Body)', 60) + # инициализируем настроки экрана и домино SCREEN_WIDTH = s.SCREEN_WIDTH SCREEN_HEIGHT = s.SCREEN_HEIGHT @@ -64,6 +67,8 @@ mouse_old_pos = [pygame.mouse.get_pos()[0], pygame.mouse.get_pos()[1]] r_click_cd = 0.2 r_click_time = 0 +win = False + while run: for event in pygame.event.get(): @@ -151,11 +156,22 @@ while run: # print(len(dominos), len(s.DOMINOS)) # если у игрока на руке не осталось фишек, и в колоде тоже, то он побеждает, и программа выходит из while if len(dominos) <= 0 and len(s.DOMINOS) <= 0: + win = True break pygame.display.flip() # экран победы + + + +if win: + text = "You win!" +else: + text = ":(" + +text = my_font.render(text, True, (255, 255, 255)) + run = True while run: for event in pygame.event.get(): @@ -172,7 +188,11 @@ while run: surf = pygame.Surface((500, 200)) color = (255, 50, 50) surf.fill(color) + rect = surf.get_rect(center=(s.SCREEN_WIDTH/2, s.SCREEN_HEIGHT/2)) screen.blit(surf, rect) + + + screen.blit(text,(s.SCREEN_WIDTH/2, s.SCREEN_HEIGHT/2)) pygame.display.flip()