def help(self): self.state = "Help" helpstring = "Press SPACE (or left click) to put the ball into motion.\n\nMove the paddle with your right and left arrow to keep the ball in play!\n\nThe ball will go left if it hits the left side of the paddle, and so on.\n\nEliminate all blocks to advance to the next level.\n\nEarn more score through combo-streaks, that is, hit as many bricks as possible without touching the paddle.\n\nWhite blocks are indestructible\n\nYou can pause and resume with ESC" menufont = load_font('audiowide.ttf', 21) menurect = Rect(270, 35, 810, 630) self.draw_bg(self.screen.get_rect()) textsurface = widgets.render_textrect(helpstring, menufont, menurect, self.WHITE, justification=0, background=self.bg_img) self.screen.blit( textsurface, (270, 35) ) #((self.screen.get_width() / 2) - menutext.get_width() / 2, (self.screen.get_height() / 2) - menutext.get_height())) self.back_text = widgets.TextWidget("Back", colour=self.WHITE, size=44, highlight_increase=3, event=self.BACK_CLICK, font_filename='audiowide.ttf', bold=False) self.back_text.rect.center = self.screen.get_rect().center self.back_text.rect.top += 250 self.help_text_widgets.append(self.back_text) self.loop()
def help(self): self.state = "Help" helpstring = "Press SPACE (or left click) to put the ball into motion.\n\nMove the paddle with your mouse to keep the ball in play!\n\nThe ball will go left if it hits the left side of the paddle, and so on.\n\nEliminate all blocks to advance to the next level.\n\nEarn more score through combo-streaks, that is, hit as many bricks as possible without touching the paddle.\n\nWhite blocks are indestructible\n\nYou can pause and resume with ESC" menufont = load_font('audiowide.ttf', 21) menurect = Rect(270,35,810,630) self.draw_bg(self.screen.get_rect()) textsurface = widgets.render_textrect(helpstring, menufont, menurect, self.WHITE, justification=0, background=self.bg_img) self.screen.blit(textsurface, (270,35))#((self.screen.get_width() / 2) - menutext.get_width() / 2, (self.screen.get_height() / 2) - menutext.get_height())) self.back_text = widgets.TextWidget("Back", colour=self.WHITE, size=44, highlight_increase=3, event=self.BACK_CLICK, font_filename='audiowide.ttf', bold=False) self.back_text.rect.center = self.screen.get_rect().center self.back_text.rect.top += 250 self.help_text_widgets.append(self.back_text) self.loop()
def highscore(self): self.state = "Highscore" highscores = "Top 20:\n\n\n" rank = 1 highscores_list = self.read_highscores() for highscore in highscores_list: highscores += str(rank) + ". " + highscore rank += 1 if len(highscores_list) == 20: highscores += "\n\nFor a full list, see highscores.txt" self.draw_bg() menufont = load_font('audiowide.ttf', 16) menurect = Rect(120, 35, 1045, 620) textsurface = widgets.render_textrect(highscores, menufont, menurect, self.WHITE, justification=1, background=self.bg_img) self.screen.blit( textsurface, (120, 35) ) #((self.screen.get_width() / 2) - menutext.get_width() / 2, (self.screen.get_height() / 2) - menutext.get_height())) self.back_text = widgets.TextWidget("Back", colour=self.WHITE, size=44, highlight_increase=3, event=self.BACK_CLICK, font_filename='audiowide.ttf', bold=False) self.back_text.rect.center = self.screen.get_rect().center self.back_text.rect.top += 250 self.highscore_text_widgets.append(self.back_text) self.loop()
def highscore(self): self.state = "Highscore" highscores = "Top 20:\n\n\n" rank = 1 highscores_list = self.read_highscores() for highscore in highscores_list: highscores += str(rank) + ". " + highscore rank += 1 if len(highscores_list) == 20: highscores += "\n\nFor a full list, see highscores.txt" self.draw_bg() menufont = load_font('audiowide.ttf', 16) menurect = Rect(120,35,1045,620) textsurface = widgets.render_textrect(highscores, menufont, menurect, self.WHITE, justification=1, background=self.bg_img) self.screen.blit(textsurface, (120,35))#((self.screen.get_width() / 2) - menutext.get_width() / 2, (self.screen.get_height() / 2) - menutext.get_height())) self.back_text = widgets.TextWidget("Back", colour=self.WHITE, size=44, highlight_increase=3, event=self.BACK_CLICK, font_filename='audiowide.ttf', bold=False) self.back_text.rect.center = self.screen.get_rect().center self.back_text.rect.top += 250 self.highscore_text_widgets.append(self.back_text) self.loop()