Main upadate
parent
4179a54943
commit
27a3bc0b92
20
main.py
20
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()
|
||||
|
|
Loading…
Reference in New Issue