added file to render pieces on board
This commit is contained in:
parent
0b8d432697
commit
a15dd6da40
15
renderPieces.py
Normal file
15
renderPieces.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import pygame
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ChessPiece(pygame.sprite.Sprite):
|
||||||
|
def __init__(self, image_path, x, y):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.image = pygame.image.load(image_path).convert_alpha()
|
||||||
|
|
||||||
|
# 3. Get the bounding box (Rect) of the image
|
||||||
|
self.rect = self.image.get_rect()
|
||||||
|
|
||||||
|
# 4. Set the initial position of the Rect
|
||||||
|
self.rect.topleft = (x, y)
|
||||||
Loading…
Reference in New Issue
Block a user