Update board
This commit is contained in:
parent
b877fbaf4e
commit
815f85c78f
20
app/board.py
20
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user