From 1a61dae476a0232f1111ac36acbfc6c384794900 Mon Sep 17 00:00:00 2001 From: Mateu Batle Date: Mon, 15 Nov 2010 04:01:40 +0000 Subject: Added title mode to game 1 Fixed text at the end of game 1 and game 2 Fixed centering of text in game 2 --- (limited to 'game1') diff --git a/game1/collectgame.py b/game1/collectgame.py index d729614..77e86b8 100755 --- a/game1/collectgame.py +++ b/game1/collectgame.py @@ -14,6 +14,7 @@ class CollectGame(usmpgames.ApplicationState): def __init__(self, game_mode, next_state = None, background = None): usmpgames.ApplicationState.__init__(self, next_state, background) self.game_mode = game_mode + self.font = pygame.font.SysFont("Arial", 50) def entering_state(self, fromStack): usmpgames.ApplicationState.entering_state(self, fromStack) @@ -26,18 +27,13 @@ class CollectGame(usmpgames.ApplicationState): def exiting_state(self, fromStack): #music_background.stop() self.next_state().clear_all() - total = self.track.num_odd + self.track.num_even - - - self.next_state().add_htmltext( - _(""" %s\n\nHas conseguido %d puntos.\n\nHas acertado %d veces.\n\nHas realizado %d errores.""") % + self.next_state().add_text2( + _(""" %s\n\nHas conseguido %d puntos.\n\nHas acertado %d veces.\n\nHas realizado %d errores.""") % (self.game_over_message(), self.player.score, self.player.num_ok, self.player.num_error), color = (0, 255, 0, 0), pos = (660, 260), - rectsize = (380, 390), - fontsize = 22, - font = "arial"); + rectsize = (380, 390)); def input(self, ms): events = pygame.event.get() @@ -75,7 +71,17 @@ class CollectGame(usmpgames.ApplicationState): self.track.drawFast(self.screen(), offsety) self.player.draw(self.screen()) self.score.draw(self.screen()) - + if self.game_mode == "pares": + self.drawText("A POR LOS PARES!", screen_size[0] / 2, 0, (0,0,0)) + else: + self.drawText("A POR LOS IMPARES!", screen_size[0] / 2, 0, (0,0,0)) + + def drawText(self, text, x, y, color): + text = self.font.render(text, 1, color) + rectText = text.get_rect() + rectText.topleft = (x, y) + self.screen().blit(text, rectText) + def game_over_message(self): if self.game_mode == "pares": total_ok = self.track.num_odd diff --git a/game1/score.py b/game1/score.py index 58e239b..1c2580b 100755 --- a/game1/score.py +++ b/game1/score.py @@ -15,7 +15,6 @@ class Score(): def __init__(self, player): self.player = player self.font = pygame.font.SysFont("Arial", 50) - pass def draw(self, screen): score = _("PUNTAJE: %05d") % self.player.score -- cgit v0.9.1