-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart_screen.py
154 lines (115 loc) · 4.69 KB
/
start_screen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 4 14:01:55 2021
@author: E
"""
import pygame
def show_bonus_window(
screen: pygame.Surface,
scoreboard: pygame.Surface,
font: pygame.font.Font,
first_color: (int, int, int),
second_color: (int, int, int),
first_total: int,
second_total: int,
countdown: int
):
text = font.render('Find Same Color!!', True, (255, 255, 255))
first_surface = font.render("Score :" + str(first_total), True, (50, 50, 255))
second_surface = font.render("Score :" + str(second_total), True, (255, 50, 50))
countdown_surface = font.render(str((countdown // 60)), True, (200, 150, 0))
pygame.draw.circle(screen, first_color, (300, 240), 60)
pygame.draw.circle(screen, second_color, (900, 240), 60)
screen.blit(scoreboard, (0, 480))
screen.blit(first_surface, (50, 505))
screen.blit(second_surface, (980, 505))
screen.blit(countdown_surface, (600, 505))
screen.blit(text, (1280 // 2 - text.get_width() // 2, 100))
print(first_total, second_total)
pygame.display.update()
def show_wait_screen(screen: pygame.Surface):
font = pygame.font.Font(None, 70)
pygame.display.set_caption('ボーナスゲーム')
background = pygame.image.load('./assets/bg.png')
background = pygame.transform.scale(background, (1200, 480))
clock = pygame.time.Clock()
screen.blit(background, (0, 0))
text = font.render("Tap S key to start bonus game", True, (0, 255, 0))
screen.blit(text, (250, 200))
pygame.display.update()
while True:
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
return
if event.type != pygame.KEYDOWN:
continue
if event.key == ord('q'):
return
elif event.key == ord('s'):
print('S')
return
clock.tick(60)
def show_setup_camera_screen(screen: pygame.Surface):
warning_font = pygame.font.Font(None, 45)
pygame.display.set_caption('カメラのセットの確認')
warning_text = warning_font.render("!! Move your camera window to play bonus game comfortably !!", True, (255, 0, 0))
screen.blit(warning_text, (100, 400))
pygame.display.update()
def show_start_screen(screen: pygame.Surface):
font = pygame.font.Font(None, 70)
pygame.display.set_caption('スタート画面')
background = pygame.image.load('./assets/bg.png')
background = pygame.transform.scale(background, (1200, 480))
clock = pygame.time.Clock()
screen.blit(background, (0, 0))
text = font.render("Tap S key", True, (200, 150, 0))
screen.blit(text, (500, 400))
pygame.display.update()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
return
if event.type != pygame.KEYDOWN:
continue
if event.key == ord('q'):
return
elif event.key == ord('s'):
print('S')
return
clock.tick(60)
def show_result_screen(screen: pygame.Surface, font: pygame.font.Font, score_font: pygame.font.Font, score1: int, score2: int):
# 真っ暗にする(今表示しているSpriteなどを消すため)
screen.fill((0, 0, 0))
game_width = 1280
game_height = 580
white = (255, 255, 255)
first_color = (50, 50, 255)
second_color = (255, 50, 50)
if score1 > score2:
background_file_name = './assets/win.png'
elif score1 < score2:
background_file_name = './assets/loose.png'
else:
background_file_name = './assets/draw.png'
background = pygame.image.load(background_file_name)
first_score_render = score_font.render(str(score1), True, white)
second_score_render = score_font.render(str(score2), True, white)
screen.blit(background, (0, 0))
pygame.draw.circle(screen, first_color, (game_width // 8, 500), 80)
pygame.draw.circle(screen, second_color, (game_width // 8 * 7, 500), 80)
diff = first_score_render.get_width() // 2
screen.blit(first_score_render, (game_width // 8 - diff, 500 - first_score_render.get_height() // 2))
diff = second_score_render.get_width() // 2
screen.blit(second_score_render, (game_width // 8 * 7 - diff, 500 - second_score_render.get_height() // 2))
pygame.display.update()
clock = pygame.time.Clock()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
return
if event.type != pygame.KEYDOWN:
continue
if event.key == ord('q'):
return
clock.tick(60)