Exemplo n.º 1
0
 def placeFood(self, painter: QPainter):
     if self.foodPlaced is False:
         self.foodX = randrange(24) * 12
         self.foodY = randrange(2, 24) * 12
         if not [self.foodX, self.foodY] in self.snakeArray:
             self.foodPlaced = True
     painter.setBrush(QColor("#ffdd55"))
     painter.drawRect(self.foodX, self.foodY, 12, 12)
Exemplo n.º 2
0
 def drawSnake(self, painter: QPainter):
     painter.setPen(Qt.PenStyle.NoPen)
     painter.setBrush(QColor("#ffffff"))
     for i in self.snakeArray:
         painter.drawRect(i[0], i[1], 12, 12)
Exemplo n.º 3
0
 def scoreBoard(self, painter: QPainter):
     painter.setPen(Qt.PenStyle.NoPen)
     painter.setBrush(QColor("#3e7a78"))
     painter.drawRect(0, 0, 300, 24)