def render(self): super(HighScoreScene, self).render() self.getGame().screen.blit(self.__highscore, (250, 0)) self.getGame().screen.blit(self.__score2, (450, 50)) self.getGame().screen.blit(self.__score1, (5, 250)) highscore = Highscore() x = 450 y = 250 for score in highscore.getScores(): self.addText(score[0], x, y, size=25) self.addText(str(score[1]), x + 200, y, size=25) y += 30
def render(self): self.getGame().screen.blit(self.__highscoreSprite, (50, 50)) self.clearText() highScores = Highscore() x = 350 y = 100 for score in highScores.getScores(): self.addText(score[0], x, y, size=30) self.addText(str(score[0]), x + 200, y, size=30) y += 30 self.addText("Press Enter to restart the game", x, y + 60, size=30) super(HighscoreScene, self).render()
def render(self): self.getGame().screen.blit(self.__highscoreSprite, (50, 50)) self.clearText() highscore = Highscore() x = 350 y = 100 for score in highscore.getScores(): self.addText(score[0], x, y, size=30) # print the player name self.addText(str(score[1]), x + 200, y, size=30) # print the player score y += 30 # increment the y value for next highscore entry self.addText("Press F1 to start a new game", x, y + 60, size=30) super(HighscoreScene, self).render()
def render(self): self.getGame().screen.blit(self.__highScoreSprite, (50, 50)) self.clearText() highscore = Highscore() x = 350 y = 100 for score in highscore.getScores(): self.addText(score[0], x, y, size=30) self.addText(str(score[1]), x + 200, y, size=30) y += 30 self.addText("Press F1 to start The Game", 50, 300, size=30) super(HighscoreScene, self).render()
def render(self): self.getGame().screen.blit(self.__highscoreSprite, (50, 50)) self.clearText() highscore = Highscore() x = 350 y = 100 for score in highscore.getScores(): self.addText(score[0], x, y, size = 30) self.addText(str(score[1]), x + 200, y, size = 30) y += 30 self.addText("Press F1 to start a new game", x, y + 60, size = 30) super(HighscoreScene, self).render()
def render(self): self.getGame().screen.blit(self.__highscoreSprite, (50, 50)) self.clearText() highscore = Highscore() x = 350 y = 100 for score in highscore.getScores(): self.addText(score[0], x, y, size = 30) self.addText(str(score[1]), x + 200, y, size = 30) # for each score increment the y by 30 px y += 30 self.addText("Press F1 to restart the game! :)", x, y + 60, size = 30) super(HighscoreScene, self).render()
def render(self): self.getGame().screen.blit(self.__highscoreSprite, (50, 50)) self.clearText() highscore = Highscore() x = 350 y = 100 for score in highscore.getScores(): self.addText(score[0], x, y, size=30) self.addText(str(score[1]), x + 200, y, size=30) y += 30 self.addText("Pressionar F1 para começar um novo jogo", x, y + 60, size=30) super(HighscoreScene, self).render()
def handleEvents(self, events): super(GameOverScene, self).handleEvents(events) for event in events: if event.type == pygame.QUIT: exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: game = self.getGame() Highscore().add(self.__playerName, game.getScore()) game.reset() game.changeScene(GameConstants.HIGHSCORE_SCENE) if event.key >= 65 and event.key <= 122: self.__playerName += chr(event.key) if event.key == pygame.K_F1: self.getGame().reset() self.getGame().changeScene(GameConstants.PLAYING_SCENE)
def handleEvents(self, events): super(GameOverScene, self).handleEvents(events) for event in events: if event.type == pygame.QUIT: exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: game = self.getGame() Highscore().add(self.__playerName, game.getScore()) game.reset() game.changeScene(GameConstants.highScoreScene) elif 65 <= event.key <= 122: self.__playerName += chr(event.key) if event.key == pygame.K_SPACE: self.getGame().reset() self.getGame().changeScene(GameConstants.playingScene)
def handleEvents(self, events): super(GameOverScene, self).handleEvents(events) for event in events: keys = pygame.key.get_pressed() if event.type == pygame.QUIT: quit() if keys[pygame.K_F1]: self.getGame().reset() self.getGame().changeScene(GameConstant.PLAYING_SCENE) if keys[pygame.K_RETURN]: game = self.getGame() Highscore().add(self.__playerName, game.getScore()) game.reset() game.changeScene(GameConstant.HIGH_SCORE_SCENE) elif event.type == pygame.KEYDOWN: currKey = event.key if currKey >= 65 and currKey <= 122: self.__playerName += chr(currKey) elif event.key == pygame.K_BACKSPACE: st = self.__playerName st = st[:-1] self.__playerName = st