Fix alternating rows issue.

This commit is contained in:
Dorian 2017-07-27 08:50:19 -04:00
parent 937d6b8b9b
commit ad550629a4
1 changed files with 4 additions and 2 deletions

View File

@ -29,8 +29,8 @@ class HexMap(Widget):
)
# Draw a hexagon in a decent spot.
tiles_in_row = int(self.width / (HEX_SIZE * HORIZONTAL_BUFFER))
# TODO: Add a tiles in alternating row.
tiles_in_even_row = int(self.width / (HEX_SIZE * HORIZONTAL_BUFFER))
tiles_in_odd_row = int((self.width - HEX_SIZE / 2) / (HEX_SIZE * HORIZONTAL_BUFFER))
tiles_in_col = int(self.height / (HEX_SIZE * VERTICAL_BUFFER))
for y in range(tiles_in_col):
@ -38,9 +38,11 @@ class HexMap(Widget):
if y % 2 == 0:
hex_color = "#0000dd55"
even_row = True
tiles_in_row = tiles_in_even_row
else:
hex_color = "#dd000055"
even_row = False
tiles_in_row = tiles_in_odd_row
for x in range(tiles_in_row):
Color(*get_color_from_hex(hex_color))