Esempio n. 1
0
 def draw(self, screen):
     pygame.draw.rect(screen, (160,160,160), (0,0,screen.get_width(),screen.get_height()))
     MiniGame.draw(self, screen)
     for qa in  self.qas:
         qa.draw(screen)
     for l in self.linesWrong:
         l.draw(screen)
     if not (self.currentLine == False):
         self.currentLine.draw(screen)
Esempio n. 2
0
 def __init__(self, screenSize, material):
     MiniGame.__init__(self, screenSize, material)
     self.questions = [self.make_question(i) for i in range(len(self.materialCopy))] #convert the material into a form the game can use
     self.questionNum = 0 #the index of the current question
     random.shuffle(self.questions) #randomize the order in which the questions appear
     self.font = pygame.font.Font(pygame.font.get_default_font(), 12) #the font with which to render all text
     self.defender = Defender(self.font, self.screenSize) #the player-controlled defender, see Invader.py
     self.score = 0 #the player's score
     self.pointsMultiplier = 255 #a score modifier that decreases over time
Esempio n. 3
0
 def __init__(self, screenSize, material):
     MiniGame.__init__(self, screenSize, material)
     self.score = 0
     self.linesWrong = []
     self.currentLine = False
     self.mousePressed = False
     positionQ = [(QABORDER+(num%2)*self.screenSize[0]/2,64*(num/2)+16) for num in range(len(self.material))]
     positionA = [(QABORDER+(num%2)*self.screenSize[0]/2,screenSize[1]/2+64*(num/2)+16) for num in range(len(self.material))]
     shuffle(positionQ)
     shuffle(positionA)
     self.qas = [QA(self.screenSize,self.material[i][0],self.material[i][1][0],positionQ[i],positionA[i]) for i in range(len(self.material))]
     self.run = True
Esempio n. 4
0
 def update(self):
     MiniGame.update(self)
     self.linesWrong = [l for l in self.linesWrong if l.update() != 3]
             
     if not (self.currentLine == False):
         temp = self.currentLine.update()
         if temp == 1:
             self.objects.append(self.currentLine)
             self.currentLine = False
         elif temp == 2:
             self.linesWrong.append(self.currentLine)
             self.currentLine = False
     pygame.display.set_caption("Score: " + str(self.score))
     self.run = False
     for qa in self.qas:
         if qa.done == False:
             self.run = True