def highscores_onmouseclick(self, event): self.highscores.onmouseclick(event) self.on_exit() highscores = HighScoresMenu("sprites/back1.jpg") highscores.run() self.reload_titles() self.highscores.onmouseclickup(event) self.on_enter()
def run(self): while 1: self.time += self.time_speed.tick(Constants.FPS) if self.gameover and (not self.pause): self.pause = True self.polygon.reset() self.timeclock.delete_timer() self.message = MessageBox(self, 4000) self.display_items.add(self.message) if self.completed and (not self.pause): self.pause = True self.polygon.reset() self.timeclock.delete_timer() self.message = MessageBox(self, 4000) self.display_items.add(self.message) self.polygon.set_alive(False) self.polygon.reset() if self.quit: self.on_exit() if self.gameover == True: h = HighScores() h.insert_HighScores(Constants.PLAYERNAME, str(self.score.get_score())) hlist = HighScores().get_HighScores() if len(hlist) < 5 or self.score.get_score( ) > hlist[4].get_points(): h.flush() pygame.event.clear() highscores = HighScoresMenu("sprites/sky.jpg") highscores.run() return False else: return self.event_manager.run() self.screen.blit(self.background, (0, 0)) self.display_items.update() self.display_items.draw(self.screen) self.atoms.update() self.atoms.draw(self.screen) if self.start == True and self.pause == False: self.display_items.remove(self.message) self.message = None self.start = False self.polygon.set_alive(False) self.polygon.reset() self.timeclock.add_timer() if not self.pause: self.polygon.draw() pygame.display.flip()
def run(self): while 1: self.time+=self.time_speed.tick(Constants.FPS) if self.gameover and (not self.pause): self.pause = True self.polygon.reset() self.timeclock.delete_timer() self.message = MessageBox(self,4000) self.display_items.add(self.message) if self.completed and (not self.pause): self.pause = True self.polygon.reset() self.timeclock.delete_timer() self.message = MessageBox(self,4000) self.display_items.add(self.message) self.polygon.set_alive(False) self.polygon.reset() if self.quit: self.on_exit() if self.gameover == True: h = HighScores() h.insert_HighScores(Constants.PLAYERNAME,str(self.score.get_score())) hlist = HighScores().get_HighScores() if len(hlist)<5 or self.score.get_score() > hlist[4].get_points(): h.flush() pygame.event.clear() highscores = HighScoresMenu("sprites/sky.jpg") highscores.run() return False else: return self.event_manager.run() self.screen.blit(self.background, (0, 0)) self.display_items.update() self.display_items.draw(self.screen) self.atoms.update() self.atoms.draw(self.screen) if self.start == True and self.pause == False: self.display_items.remove(self.message) self.message = None self.start = False self.polygon.set_alive(False) self.polygon.reset() self.timeclock.add_timer() if not self.pause: self.polygon.draw() pygame.display.flip()
def on_exit(self): Level.on_exit(self) h = HighScores() h.insert_HighScores(Constants.PLAYERNAME,str(self.score.get_score())) hlist = HighScores().get_HighScores() if len(hlist)<5 or self.score.get_score() > hlist[4].get_points(): h.flush() pygame.event.clear() highscores = HighScoresMenu("sprites/sky.jpg") highscores.run()
def on_exit(self): Level.on_exit(self) h = HighScores() h.insert_HighScores(Constants.PLAYERNAME, str(self.score.get_score())) hlist = HighScores().get_HighScores() if len(hlist) < 5 or self.score.get_score() > hlist[4].get_points(): h.flush() pygame.event.clear() highscores = HighScoresMenu("sprites/sky.jpg") highscores.run()