From 815f85c78f96200bfc1838c8aeab1f965599dd99 Mon Sep 17 00:00:00 2001 From: Mfpass1992 Date: Tue, 16 Mar 2021 13:47:37 +0100 Subject: [PATCH] Update board --- app/board.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/app/board.py b/app/board.py index 86a0d2c..19f72ba 100644 --- a/app/board.py +++ b/app/board.py @@ -27,30 +27,24 @@ class Board: def draw(self, screen: pygame.Surface): - size = (FIELD_SIZE/HORIZONTAL_NUM_OF_FIELDS, FIELD_SIZE/HORIZONTAL_NUM_OF_FIELDS) for x in range(len(self.__fields)): for y in range(len(self.__fields[x])): obj = self.__fields[x][y] - i = x * FIELD_SIZE - j = y * FIELD_SIZE + pos_x = x * FIELD_SIZE + FIELD_SIZE//2 + pos_y = y * FIELD_SIZE + FIELD_SIZE//2 if obj == 'grass': - grassrect.size = (size) - grassrect.center = (i, j) + grassrect.center = (pos_x, pos_y) screen.blit(grass, grassrect) if obj == 'corn': - cornrect.size = (size) - cornrect.center = (i, j) + cornrect.center = (pos_x, pos_y) screen.blit(corn, cornrect) if obj == 'sunflower': - sunflowerrect.size = (size) - sunflowerrect.center = (i, j) + sunflowerrect.center = (pos_x, pos_y) screen.blit(sunflower, sunflowerrect) if obj == 'sand': - sandrect.size = (size) - sandrect.center = (i, j) + sandrect.center = (pos_x, pos_y) screen.blit(sand, sandrect) if obj == 'clay': - clayrect.size = (size) - clayrect.center = (i, j) + clayrect.center = (pos_x , pos_y) screen.blit(clay, clayrect)