board.py
Tue Aug 09 2022 20:06:07 GMT+0000 (Coordinated Universal Time)
Saved by
@ammu123
import pygame
class Board:
#a class to manage the board
#it's basically a package to store all
#attributes/methods for the board
#the game parameter is an instance
#of the TicTacToe class
def __init__(self, game):
#Create the board and its attributes
self.screen = game.screen
self.screen_rect = game.screen.get_rect()
#load the board image onto screen
#and also get its "rect"
self.image = pygame.image.load("tictactoeImage.png")
self.rect = self.image.get_rect()
#Center the board
#positions image in horizontal center of screen
self.rect.centerx = self.screen_rect.centerx
#positions image at the top of the screen
self.rect.top = self.screen_rect.top
#blitme is going to draw the board to the screen
def blitme(self):
self.screen.blit(self.image, self.rect)
content_copyCOPY
Comments