diff options
-rwxr-xr-x | game1/collectgame.py | 24 | ||||
-rwxr-xr-x | game1/score.py | 1 | ||||
-rwxr-xr-x | game2/game2.py | 13 |
3 files changed, 21 insertions, 17 deletions
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( - _(""" <b>%s</b>\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 diff --git a/game2/game2.py b/game2/game2.py index 18fbc6b..f5d2403 100755 --- a/game2/game2.py +++ b/game2/game2.py @@ -148,13 +148,11 @@ class Game2(usmpgames.ApplicationState): def exiting_state(self, fromStack): global score self.next_state().clear_all() - self.next_state().add_htmltext( - _(""" <b>Felicidades</b>\n\nHas conseguido %d puntos""") % score, + self.next_state().add_text2( + _(""" Felicidades\n\nHas conseguido %d puntos""") % score, color = (0, 255, 0, 0), pos = (660, 260), - rectsize = (380, 390), - fontsize = 22, - font = "arial"); + rectsize = (380, 390) ); def loop(self, ms): global gameOverSound, correctAnswerSound, musicSound @@ -411,7 +409,7 @@ class Game2(usmpgames.ApplicationState): surface.blit(sad, rectBunny) #surface.blit(sad, rectBunny) score=returnScore() - drawText(_('RESPUESTA INCORRECTA!'), font, surface, (WINDOWWIDTH / 2.85), (WINDOWHEIGHT / 2.25), TEXTCOLOR) + drawText(_('RESPUESTA INCORRECTA!'), font, surface, (WINDOWWIDTH / 4), (WINDOWHEIGHT / 2.25), TEXTCOLOR) drawText(_('RESPUESTA CORRECTA: '+str(result)), font, surface, (WINDOWWIDTH / 3.8), (WINDOWHEIGHT / 2.25)+50, TEXTCOLOR) drawText(_('PULSA UNA TECLA'), font, surface, (WINDOWWIDTH / 3), (WINDOWHEIGHT / 2.25) + 100, TEXTCOLOR) @@ -439,7 +437,8 @@ class Game2(usmpgames.ApplicationState): ######################################## methods #Time Limit -TIMELIMIT=240.0 +#TIMELIMIT=240.0 +TIMELIMIT=30.0 #print ('time: '+str(TIMESTART)) def compareTime(playTime, gamestate): |