proba/board.py

26 lines
592 B
Python

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)