def starting_screen(self): self.screen = pygame.Surface(self._display_surf.get_size()) self.clear_screen() self.screen = self.screen.convert() self.player = Player(self.screen, self.playerShip) write(self.screen, "SPACE SHOOTERS", 54, color("white"), (155, 100)) write(self.screen, "PRESS ENTER TO START", 32, color("white"), (190, 200))
def playGame(game): game.clear_screen() game.display_stats() # Bet # Money input from user if game.betting: write(game.screen, "BET", 54, color("black"), (game.width / 2 - 20, game.height / 2 - 54)) write(game.screen, str(game.bet), 48, color("black"), (game.width / 2 - 20, game.height / 2 + 10)) write(game.screen, "Press a to increase and d to decrease, Press b to bet!", 32, color("black"), (game.width / 8, game.height / 2 + 64)) if game.pressedKeys[pygame.K_b]: if game.bet > game.money or game.bet <= 0: write(game.screen, "Not enough money", 32, color("black"), (game.width / 3, game.height / 2 + 90)) else: game.betting = False game.money -= game.bet elif game.pressedKeys[pygame.K_a]: game.bet += 10 elif game.pressedKeys[pygame.K_d]: if game.bet > 0: game.bet -= 10 else: # Distribute cards if game.distributing: # display user cards cardY = game.height * 3 / 4 cardX = game.width / 2 - 100 for card in game.player.cards: card.render(cardX, cardY) cardX += 25
def winning_screen(self): # Repainting screen self.clear_screen() write(self.screen, "YOU WON!", 54, color("green"), (210, 100)) write(self.screen, "SCORE: %s" % (self.score), 32, color("white"), (235, 200)) write(self.screen, "PRESS ENTER TO PLAY AGAIN!", 32, color("white"), (150, 250)) self.player = []
def display_game_stats(self): # Current level write(self.screen, "LEVEL: %s" % (self.level), 24, color("white"), (0, 0)) # Current Health write(self.screen, "HEALTH: %s" % (self.player.health), 24, color("white"), (200, 0)) # Current score write(self.screen, "SCORE: %s" % (self.score), 24, color("white"), (400, 0))
def game_over(self): # Repainting screen self.clear_screen() write(self.screen, "GAMEOVER!", 54, color("red"), (200, 100)) write(self.screen, "SCORE: %s" % (self.score), 32, color("white"), (235, 200)) write(self.screen, "PRESS ENTER TO PLAY AGAIN!", 32, color("white"), (150, 250)) self.player = []