Main upadate
parent
4179a54943
commit
27a3bc0b92
20
main.py
20
main.py
|
@ -15,6 +15,9 @@ from pygame.locals import (
|
||||||
|
|
||||||
pygame.init()
|
pygame.init()
|
||||||
|
|
||||||
|
pygame.font.init()
|
||||||
|
my_font = pygame.font.SysFont('Calibri (Body)', 60)
|
||||||
|
|
||||||
# инициализируем настроки экрана и домино
|
# инициализируем настроки экрана и домино
|
||||||
SCREEN_WIDTH = s.SCREEN_WIDTH
|
SCREEN_WIDTH = s.SCREEN_WIDTH
|
||||||
SCREEN_HEIGHT = s.SCREEN_HEIGHT
|
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_cd = 0.2
|
||||||
r_click_time = 0
|
r_click_time = 0
|
||||||
|
|
||||||
|
win = False
|
||||||
|
|
||||||
while run:
|
while run:
|
||||||
|
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
|
@ -151,11 +156,22 @@ while run:
|
||||||
# print(len(dominos), len(s.DOMINOS))
|
# print(len(dominos), len(s.DOMINOS))
|
||||||
# если у игрока на руке не осталось фишек, и в колоде тоже, то он побеждает, и программа выходит из while
|
# если у игрока на руке не осталось фишек, и в колоде тоже, то он побеждает, и программа выходит из while
|
||||||
if len(dominos) <= 0 and len(s.DOMINOS) <= 0:
|
if len(dominos) <= 0 and len(s.DOMINOS) <= 0:
|
||||||
|
win = True
|
||||||
break
|
break
|
||||||
|
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
|
|
||||||
# экран победы
|
# экран победы
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if win:
|
||||||
|
text = "You win!"
|
||||||
|
else:
|
||||||
|
text = ":("
|
||||||
|
|
||||||
|
text = my_font.render(text, True, (255, 255, 255))
|
||||||
|
|
||||||
run = True
|
run = True
|
||||||
while run:
|
while run:
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
|
@ -172,7 +188,11 @@ while run:
|
||||||
surf = pygame.Surface((500, 200))
|
surf = pygame.Surface((500, 200))
|
||||||
color = (255, 50, 50)
|
color = (255, 50, 50)
|
||||||
surf.fill(color)
|
surf.fill(color)
|
||||||
|
|
||||||
rect = surf.get_rect(center=(s.SCREEN_WIDTH/2, s.SCREEN_HEIGHT/2))
|
rect = surf.get_rect(center=(s.SCREEN_WIDTH/2, s.SCREEN_HEIGHT/2))
|
||||||
screen.blit(surf, rect)
|
screen.blit(surf, rect)
|
||||||
|
|
||||||
|
|
||||||
|
screen.blit(text,(s.SCREEN_WIDTH/2, s.SCREEN_HEIGHT/2))
|
||||||
|
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
|
|
Loading…
Reference in New Issue