Projekt_AI-Automatyczny_saper/Engine/Board.py
2021-03-16 18:53:26 +01:00

27 lines
938 B
Python

import pygame
from Constants import ROWS, COLS, SQUARE_SIZE, GREEN, BLACK, WIDTH
class Board:
def __init__(self):
self.board = []
def drawSquares(self, win):
win.fill(GREEN)
for row in range(ROWS):
for col in range(COLS):
pygame.draw.rect(win, BLACK, pygame.Rect(row * SQUARE_SIZE, col * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE), 2)
def drawAgent(self, win, agent):
rect = agent.image.get_rect()
rect.center = (agent.x * SQUARE_SIZE + SQUARE_SIZE / 2, agent.y * SQUARE_SIZE + SQUARE_SIZE / 2 - 5)
win.blit(agent.image, rect)
def drawBombs(self,win, x, y):
image = pygame.image.load('Engine/bomb.png')
image = pygame.transform.scale(image, (SQUARE_SIZE, SQUARE_SIZE))
rect = image.get_rect()
rect.center = (x * SQUARE_SIZE + SQUARE_SIZE/2 + 5, y * SQUARE_SIZE + SQUARE_SIZE/2 - 5)
win.blit(image, rect)