Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/dev/pacmath.activity/question.py
diff options
context:
space:
mode:
Diffstat (limited to 'dev/pacmath.activity/question.py')
-rw-r--r--dev/pacmath.activity/question.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/dev/pacmath.activity/question.py b/dev/pacmath.activity/question.py
index c492541..5dd01c9 100644
--- a/dev/pacmath.activity/question.py
+++ b/dev/pacmath.activity/question.py
@@ -45,6 +45,7 @@ class question:
self.drawQuestion(screen)
self.pacman = pygame.image.load("./images/pacmanr.png").convert_alpha()
self.screen = screen
+
def nextQuestion(self):
if(len(self.answered) > 3):
return False
@@ -177,11 +178,20 @@ class question:
@param count: the number of lives we have
"""
self.clearLives(screen)
- offset = 0
- for i in range(count):
- offset += 30
+ if count < 10:
+ offset = 0
+ for i in range(count):
+ offset += 30
+ screen.blit(self.pacman, (900-offset, 640))
+ pygame.display.update(pygame.Rect(900-offset, 640, offset, 30))
+ else:
+ offset = 30
screen.blit(self.pacman, (900-offset, 640))
- pygame.display.update(pygame.Rect(900-offset, 640, offset, 30))
+ offset += 5
+ text = pygame.font.Font(None, 36).render( str(count), 1, self.QUESTION_COLOR )
+ screen.blit( text, (900 - text.get_width() - offset, 640))
+ offset += text.get_width()
+ pygame.display.update(pygame.Rect(900-offset, 640, offset, 30))
def clearLives(self, screen):
"""
@@ -224,16 +234,16 @@ class question:
self.clearLevel(screen)
text = pygame.font.Font(None, 36).render( 'Level: ' + str(level), 1, self.QUESTION_COLOR )
- screen.blit(text, (900-text.get_width(), 625))
- pygame.display.update(pygame.Rect(900-text.get_width(), 625, text.get_width(), 30))
+ screen.blit(text, (900-text.get_width(), 605))
+ pygame.display.update(pygame.Rect(900-text.get_width(), 605, text.get_width(), 30))
def clearLevel(self, screen):
"""
Draws a black box over the score display so that we may redraw it
@param screen: the screen on which to draw
"""
- blackBox = pygame.Surface((300,30))
+ blackBox = pygame.Surface((275,30))
blackBox.fill((0,0,0))
- screen.blit(blackBox, (600,635))
- pygame.display.update(pygame.Rect(600, 670, 300, 30))
+ screen.blit(blackBox, (625,605))
+ pygame.display.update(pygame.Rect(625, 605, 275, 30))