diff --git a/board.py b/board.py new file mode 100644 index 0000000..bd8a3bf --- /dev/null +++ b/board.py @@ -0,0 +1,22 @@ +import pygame as pg + +def render_board(): + posX, posY = 0, 0 #recatangle position x, recatangle position y + s1 = True #wether or not the first square of the row should be black or white + + #render frame + screen.fill("black") + + #chess game + while posY < size: + posX = 0 + if not s1: + posX = posX + size / 8 + while posX <= size: + pg.draw.rect(screen, color, (posX, posY, sizeW, sizeH)) + posX = posX + size / 4 + posY = posY + size / 8 + s1 = not s1 + +def test_def(): + print("This is a test") \ No newline at end of file diff --git a/main.py b/main.py index c4c81c3..d34c9bf 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,5 @@ import pygame as pg +from board import render_board #chess pieces p1 = "pawn" @@ -47,8 +48,6 @@ while running: #open window posY = posY + size / 8 s1 = not s1 - - #flip display to put game on screen pg.display.flip()