Exemplo n.º 1
0
 def gameOver(self, event: QPaintEvent, painter: QPainter):
     info = ""
     if self.score > self.highscore:
         self.lives += 1
         self.highscore = self.score
         info = "\n\nNew high score! 1 life replenished."
     font_size = 10 if not is_mac else 12
     painter.setPen(QColor(0, 34, 3))
     painter.setFont(QFont("Decorative", font_size))
     if self.lives > 0:
         msg = "GAME OVER{}\n\nPress space to play again".format(info)
     else:
         self.setCursor(Qt.CursorShape.PointingHandCursor)
         msg = ("GAME OVER\n\nYou're out of lives for today,\n"
                "but tomorrow is another day :)\n\n"
                "Tip: Get more lives by\nkeeping up with your reviews!\n\n"
                "Pro-Tip: Pledge your support on Patreon\n"
                "and get access to other secret\n"
                "features and add-ons :)"
                "\n\nClick here to go to\n"
                "patreon.com/glutanimate")
     painter.drawText(event.rect(), Qt.AlignmentFlag.AlignCenter, msg)
Exemplo n.º 2
0
 def scoreText(self, event: QPaintEvent, painter: QPainter):
     painter.setPen(QColor("#ffffff"))
     painter.setFont(QFont("Decorative", 10))
     painter.drawText(4, 17, "LIVES: " + str(self.lives))
     painter.drawText(120, 17, "SCORE: " + str(self.score))
     painter.drawText(230, 17, "BEST: " + str(self.highscore))