Pygame | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Pygame

this is my code for a grid in pygame: class Grid: def __init__(self, x, y): self.x = x self.y = y def draw(self): pygame.draw.rect(screen, GREY, [self.x * WIDTH, self.y * HEIGHT, WIDTH, HEIGHT], 1) pygame.display.update() cols = 22 rows = 16 WIDTH = 20 HEIGHT = 20 BLACK = (0, 0, 0) GREY = (127,127,127) grid = [0 for i in range(cols)] for node in range(cols): grid[node] = [0 for node in range(rows)] for x in range(cols): for y in range(rows): grid[x][y] = Grid(x, y) for x in range(cols): for y in range(rows): grid[x][y].draw() how to I get the vertices of each square?

4th Jan 2021, 3:15 PM
Kirill
Kirill - avatar
2 Answers
+ 1
Florenc Bardhi from tech with Tim, check him out on YouTube, he is great
4th Jan 2021, 5:21 PM
Kirill
Kirill - avatar
0
Wow where did you learned that?!
4th Jan 2021, 5:00 PM
FᄂӨЯΣПᄃ BΛЯDΉI
FᄂӨЯΣПᄃ BΛЯDΉI - avatar