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:
authorMichael Kitson <msk5293@rit.edu>2010-11-04 18:50:25 (GMT)
committer Michael Kitson <msk5293@rit.edu>2010-11-04 18:50:25 (GMT)
commitb24480b125210cd43c6b742ae5f39e3d9918df81 (patch)
tree4d2542bf3989311cb473d24c7f1a684ac18fc8ee /dev/pacmath.activity/question.py
parent091b7667dedc31c3088afe87c824d6cdfa3b6c5e (diff)
Finished adding pause screen, press p to pause the game
Diffstat (limited to 'dev/pacmath.activity/question.py')
-rw-r--r--dev/pacmath.activity/question.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/dev/pacmath.activity/question.py b/dev/pacmath.activity/question.py
index ac05b0e..7c3b6b0 100644
--- a/dev/pacmath.activity/question.py
+++ b/dev/pacmath.activity/question.py
@@ -23,6 +23,8 @@ class question:
# Size of rectangles
SIZE = (275, 75)
+ QUESTION_COLOR = (94,246,0)
+
# Default
def __init__ (self, screen, quests):
"""
@@ -32,14 +34,18 @@ class question:
"""
# Draw the answers and questions
self.questions = quests
+ self.question = self.questions[random.randint(0,3)][0]
+ self.drawAnswers(screen)
+ self.drawQuestion(screen)
+
+
+ def drawAnswers(self, screen):
self.drawAnswer(screen, self.questions[0][1], 1)
self.drawAnswer(screen, self.questions[1][1], 2)
self.drawAnswer(screen, self.questions[2][1], 3)
self.drawAnswer(screen, self.questions[3][1], 4)
- self.drawQuestion(screen, self.questions[random.randint(0,3)][0])
-
-
+
# Draws the answer in a ghost colored rectangle
def drawAnswer(self, screen, answer, choice):
"""
@@ -82,7 +88,7 @@ class question:
screen.blit(g, (pos[0] + 4, pos[1] + 4))
# Draws the question
- def drawQuestion(self, screen, question):
+ def drawQuestion(self, screen):
"""
Draws the question
@param screen: the screen in which we will draw
@@ -92,5 +98,19 @@ class question:
font = pygame.font.Font(None, 72)
# Draws the question under maze
- q = font.render(question, 1, (94,246,0))
+ q = font.render(self.question, 1, self.QUESTION_COLOR)
+ self.clearBottom(screen)
+ screen.blit(q, (0, 640))
+ pygame.display.flip()
+ def drawPaused(self, screen):
+ # Font used
+ font = pygame.font.Font(None, 72)
+
+ q = font.render("Paused", 1, self.QUESTION_COLOR)
+ self.clearBottom(screen)
screen.blit(q, (0, 640))
+ pygame.display.flip()
+ def clearBottom(self, screen):
+ blackBox = pygame.Surface((900,60))
+ blackBox.fill((0,0,0))
+ screen.blit(blackBox, (0,640))