import pygame from Constants import ROWS, COLS, SQUARE_SIZE, GREEN, BLACK, WIDTH from Engine.Bomb import Bomb class Board: def __init__(self, win): self.board = [] self.bombMap = {} self.stoneMap = {} self.win = win 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): agent.rotateImage() rect = agent.image.get_rect() rect.center = (agent.getPoint().getX() * SQUARE_SIZE + SQUARE_SIZE / 2, agent.getPoint().getY() * SQUARE_SIZE + SQUARE_SIZE / 2 - 5) win.blit(agent.image, rect) def drawBombs(self): for key in self.bombMap: bomb = self.bombMap[key] if not bomb.isDefused: image = pygame.image.load('Engine/' + bomb.bombType + '.png') image = pygame.transform.scale(image, (SQUARE_SIZE - 5, SQUARE_SIZE - 5)) rect = image.get_rect() rect.center = (key.getX() * SQUARE_SIZE + SQUARE_SIZE / 2, key.getY() * SQUARE_SIZE + SQUARE_SIZE / 2) self.win.blit(image, rect) def drawStones(self): for key in self.stoneMap: image = pygame.image.load('Engine/stone.png') image = pygame.transform.scale(image, (SQUARE_SIZE - 5, SQUARE_SIZE - 5)) rect = image.get_rect() rect.center = (key.getX() * SQUARE_SIZE + SQUARE_SIZE / 2, key.getY() * SQUARE_SIZE + SQUARE_SIZE / 2) self.win.blit(image, rect) def getBomb(self, point): if point in self.bombMap: return self.bombMap[point] return Bomb(0,0,"")