Compare commits
No commits in common. "62d78779030f6eee4ccfaa28b05247221f9de842" and "0b8d432697672802864f2d5971eef8ae2d7fd650" have entirely different histories.
62d7877903
...
0b8d432697
9
main.py
9
main.py
@ -3,7 +3,8 @@ import numpy as np
|
|||||||
|
|
||||||
from board import render_board
|
from board import render_board
|
||||||
from position import pos
|
from position import pos
|
||||||
from renderPieces import ChessPiece
|
|
||||||
|
#print(pos)
|
||||||
|
|
||||||
pg.init()
|
pg.init()
|
||||||
size = 900
|
size = 900
|
||||||
@ -11,10 +12,6 @@ screen = pg.display.set_mode((size, size))
|
|||||||
clock = pg.time.Clock()
|
clock = pg.time.Clock()
|
||||||
running = True
|
running = True
|
||||||
|
|
||||||
all_pieces = pg.sprite.Group()
|
|
||||||
bRook = ChessPiece("pieces/b-rook.png",0 ,0)
|
|
||||||
all_pieces.add(bRook)
|
|
||||||
|
|
||||||
while running: #open window
|
while running: #open window
|
||||||
for event in pg.event.get():
|
for event in pg.event.get():
|
||||||
if event.type == pg.QUIT:
|
if event.type == pg.QUIT:
|
||||||
@ -22,8 +19,6 @@ while running: #open window
|
|||||||
|
|
||||||
render_board(screen, size)
|
render_board(screen, size)
|
||||||
|
|
||||||
all_pieces.draw(screen)
|
|
||||||
|
|
||||||
#flip display to put game on screen
|
#flip display to put game on screen
|
||||||
pg.display.flip()
|
pg.display.flip()
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
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