AIprojekt-wozek/Grid.py

22 lines
673 B
Python

import pygame
WINDOW_X = 1400
WINDOW_Y = 750
RECT_SIZE = 50
class Grid:
def __init__(self, window):
self.window = window
# function to draw a grid, it draws a line every 50px(RECT_SIZE) for both x and y axis
def draw_grid(self):
num_of_columns = int(WINDOW_X / RECT_SIZE)
num_of_rows = int(WINDOW_Y / RECT_SIZE)
x = 0
y = 0
for i in range(num_of_columns):
x += RECT_SIZE
pygame.draw.line(self.window, (255, 255, 255), (x, 0), (x, WINDOW_Y))
for i in range(num_of_rows):
y += RECT_SIZE
pygame.draw.line(self.window, (255, 255, 255), (0, y), (WINDOW_X, y))