+ 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?
2 Answers
+ 1
Florenc Bardhi from tech with Tim, check him out on YouTube, he is great
0
Wow where did you learned that?!