Merge branch 'llfkj' of https://github.com/llf-amy/gamecamp into llfkj
This commit is contained in:
commit
6e4c3a0b0b
13
main.py
13
main.py
|
@ -27,7 +27,7 @@ class StrategyGame(FloatLayout):
|
|||
self.main_map.add_widget(hex_cell)
|
||||
|
||||
# Add overlay conditionally.
|
||||
if (row % 6 == 1 and col % 2 == 1) or (row % 6 == 4 and col % 2 == 0):
|
||||
if (row % 6 == 1 and col % 2 == 1) or (row % 6 == 4 and col % 2 == 0) and (col > 0):
|
||||
print('({}, {})'.format(row, col))
|
||||
|
||||
# Determine the location of the solid hexagon cell. Needs to be offset from the centre of the hex.
|
||||
|
@ -48,8 +48,9 @@ class StrategyGame(FloatLayout):
|
|||
|
||||
Color(1, 1, 1, 1)
|
||||
hex_cell.coord_label = Label(
|
||||
text=hex_cell.coordinate_text(), center_x=hex_cell.x, center_y=hex_cell.y)
|
||||
|
||||
text=hex_cell.map_display_text(),
|
||||
center_x=hex_cell.x,
|
||||
center_y=hex_cell.y)
|
||||
|
||||
# Bind the cell code so as to update its position and size when the parent widget resizes.
|
||||
hex_cell.bind(pos=hex_cell.update_pos, size=hex_cell.update_pos)
|
||||
|
@ -63,6 +64,12 @@ class HexMapCell(Label):
|
|||
def coordinate_text(self):
|
||||
return '({}, {})'.format(self.coords.row, self.coords.col)
|
||||
|
||||
def map_coordinate_text(self):
|
||||
return '[{}, {}]'.format(self.coords.row / 3, self.coords.col / 2)
|
||||
|
||||
def map_display_text(self):
|
||||
return "{}\n{}".format(self.coordinate_text(), self.map_coordinate_text())
|
||||
|
||||
def update_pos(self, instance, value):
|
||||
# Determine the location of the solid hexagon cell. Needs to be offset from the centre of the hex.
|
||||
radius = 2 * self.height
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<StrategyGame>:
|
||||
id: _game
|
||||
main_map: _main_map
|
||||
map_rows: 30
|
||||
map_rows: 15
|
||||
map_cols: 10
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
|
|
Loading…
Reference in New Issue