proba/board.py

26 lines
592 B
Python
Raw Permalink Normal View History

2024-03-10 02:46:14 +01:00
import pygame
from constant import size, rows, cols
class Board:
def __init__(self):
self.board = []
def load_images(self):
self.grass = pygame.image.load("grass.png")
self.dirt = pygame.image.load("dirt.png")
def draw_cubes(self, win):
for row in range(rows):
for col in range(cols):
cube_rect = pygame.Rect(row * size, col * size, size, size)
if (row + col) % 2 == 0:
win.blit(self.grass, cube_rect)
else:
win.blit(self.dirt, cube_rect)