def draw_button(self): btn_surface = pygame.Surface([300, 70]) btn_surface.fill(COLOR_BTN) text = get_font(50).render("Try again?", True, (255, 255, 255)) self.draw_center(text, btn_surface) (btn_x, btn_y) = self.draw_center(btn_surface, self.image) self.btn_rect = pygame.Rect(btn_x, btn_y, 300, 70)
def draw(self): self.image.fill(GAME_OVER) text = get_font(100).render("You found a bug!", True, (255, 255, 255)) self.draw_center(text, self.image, 0, -100) w, h = text.get_width(), text.get_height() pw, ph = self.image.get_width(), self.image.get_height() dw = (pw / 2) - (w / 2) dh = (ph / 2) - (h / 2) self.image.blit(text, (dw, dh - 100)) self.draw_button()