def update(self, keys): game_over = self.game_over_font.render("Game Over", 1, GREEN) w = game_over.get_width() h = game_over.get_height() x = (WIDTH - w) / 2 y = (HEIGHT - h) / 2 DISPLAYSURF.blit(game_over, (x, y)) message = "Press space bar to play again, Q to Quit" begin = self.normal_font.render(message, 1, GREEN) DISPLAYSURF.blit(begin, ((WIDTH - begin.get_width()) / 2, 400)) if keys[K_SPACE]: self.done = True if keys[K_q]: self.quit = True
def update(self, keys): if self.font_size <= 200: welcome = pygame.font.SysFont("monospace", self.font_size) pong = welcome.render("PONG!", 1, GREEN) w = pong.get_width() h = pong.get_height() x = (WIDTH - w) / 2 y = (HEIGHT - h) / 2 DISPLAYSURF.fill(BLACK, (x, y, w, h)) DISPLAYSURF.blit(pong, (x,y)) self.font_size += 1 elif not self.ready: begin = self.normal_font.render("Press space bar to start", 1, GREEN) DISPLAYSURF.blit(begin, ((WIDTH - begin.get_width()) / 2, 400)) self.ready = True if keys[K_SPACE]: self.done = True