Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game1
diff options
context:
space:
mode:
authorMateu Batle <mateu.batle@collabora.co.uk>2010-11-15 04:01:40 (GMT)
committer Mateu Batle <mateu.batle@collabora.co.uk>2010-11-15 04:01:40 (GMT)
commit1a61dae476a0232f1111ac36acbfc6c384794900 (patch)
treedad5cf270f21238ac4f896a97e347ddaaa89ded8 /game1
parent8f6895f91e54534b585edc4ad76fbd9c29d0688a (diff)
Added title mode to game 1
Fixed text at the end of game 1 and game 2 Fixed centering of text in game 2
Diffstat (limited to 'game1')
-rwxr-xr-xgame1/collectgame.py24
-rwxr-xr-xgame1/score.py1
2 files changed, 15 insertions, 10 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