MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / countdown

Function countdown

projects/car game/Game.py:133–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

131
132###### Countdown ######
133def countdown():
134 font2 = pygame.font.Font("freesansbold.ttf", 85)
135 countdownBacground = pygame.image.load("bg.png")
136 three = font2.render("3", True, (187, 30, 16))
137 two = font2.render("2", True, (255, 255, 0))
138 one = font2.render("1", True, (51, 165, 50))
139 go = font2.render("GO!!!", True, (0, 255, 0))
140
141 ##### displaying blank background #####
142 screen.blit(countdownBacground, (0, 0))
143 pygame.display.update()
144
145 ###### Displaying three (3) ######
146 screen.blit(three, (350, 250))
147 pygame.display.update()
148 time.sleep(1)
149
150 ##### displaying blank background #####
151 screen.blit(countdownBacground, (0, 0))
152 pygame.display.update()
153 time.sleep(1)
154
155 ###### Displaying two (2) ######
156 screen.blit(two, (350, 250))
157 pygame.display.update()
158 time.sleep(1)
159
160 ##### displaying blank background #####
161 screen.blit(countdownBacground, (0, 0))
162 pygame.display.update()
163 time.sleep(1)
164
165 ###### Displaying one (1) ######
166 screen.blit(one, (350, 250))
167 pygame.display.update()
168 time.sleep(1)
169
170 ##### displaying blank background #####
171 screen.blit(countdownBacground, (0, 0))
172 pygame.display.update()
173 time.sleep(1)
174
175 ###### Displaying Go!!! ######
176 screen.blit(go, (300, 250))
177 pygame.display.update()
178 time.sleep(1)
179 gameloop() # calling the gamloop so that our game can start after the countdown
180 pygame.display.update()
181
182
183# defining our gameloop function

Callers 2

introscreenFunction · 0.70
gameoverFunction · 0.70

Calls 2

gameloopFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected