Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import pygame
  2.  
  3. pygame.init()
  4.  
  5. class Main(object):
  6. def __init__(self, width, height, tilesize, color):
  7. self.width = width
  8. self.height = height
  9. self.tilesize = tilesize
  10. self.color = color
  11. self.gridwidth = self.width / self.tilesize
  12. self.gridheight = self.height / self.tilesize
  13. self.window = pygame.display.set_mode((self.width, self.height))
  14.  
  15.  
  16. def draw_grid(self):
  17. for x in range(0, self.width, self.tilesize):
  18. pygame.draw.line(self.window, self.color, (x, 0), (x, self.height))
  19. for y in range(0, self.height, self.tilesize):
  20. pygame.draw.line(self.window, self.color, (0, y), (self.width, y))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement