Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- pygame.init()
- class Main(object):
- def __init__(self, width, height, tilesize, color):
- self.width = width
- self.height = height
- self.tilesize = tilesize
- self.color = color
- self.gridwidth = self.width / self.tilesize
- self.gridheight = self.height / self.tilesize
- self.window = pygame.display.set_mode((self.width, self.height))
- def draw_grid(self):
- for x in range(0, self.width, self.tilesize):
- pygame.draw.line(self.window, self.color, (x, 0), (x, self.height))
- for y in range(0, self.height, self.tilesize):
- pygame.draw.line(self.window, self.color, (0, y), (self.width, y))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement