Python draw apple
5 Python code examples are found related to "
draw apple".
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: games_pi.py From ledmatrix with BSD 2-Clause "Simplified" License | 6 votes |
def drawApple(coord): x = coord['x'] y = coord['y'] drawPixel(x,y,2) # pong subroutines #
Example 2
Source File: snaky.py From Snaky with MIT License | 5 votes |
def drawApple(coord): x = coord['x'] * CELLSIZE y = coord['y'] * CELLSIZE appleRect = pygame.Rect(x, y, CELLSIZE, CELLSIZE) pygame.draw.rect(DISPLAYSURF, RED, appleRect)
Example 3
Source File: snake_app.py From SnakeAI with MIT License | 5 votes |
def draw_apple(self, painter: QtGui.QPainter) -> None: apple_location = self.snake.apple_location if apple_location: painter.setRenderHints(QtGui.QPainter.HighQualityAntialiasing) painter.setPen(QtGui.QPen(Qt.black)) painter.setBrush(QtGui.QBrush(Qt.green)) painter.drawRect(apple_location.x * SQUARE_SIZE[0], apple_location.y * SQUARE_SIZE[1], SQUARE_SIZE[0], SQUARE_SIZE[1])
Example 4
Source File: game.py From Snake-Game-AI with MIT License | 5 votes |
def drawApple(coord): x = coord['x'] * CELLSIZE y = coord['y'] * CELLSIZE appleRect = pygame.Rect(x, y, CELLSIZE, CELLSIZE) pygame.draw.rect(DISPLAYSURF, RED, appleRect)
Example 5
Source File: snake.py From gamedev with MIT License | 4 votes |
def draw_apple(loc): x, y = loc x *= CELLSIZE y *= CELLSIZE apple_rect = pygame.Rect(x, y, CELLSIZE, CELLSIZE) pygame.draw.rect(screen, RED, apple_rect)