diff --git a/hexmap.py b/hexmap.py index 88ec1ec..c20945c 100644 --- a/hexmap.py +++ b/hexmap.py @@ -53,7 +53,7 @@ class HexMapCell(Label): return '{}\n{}\n{}'.format(*self.cube_coords) def map_display_text(self): - return "{}\n{} \n {}".format(self.even_r_coordinate_text(), self.cube_coordinate_text(), terrain) + return "{}\n{} \n {}".format(self.even_r_coordinate_text(), self.cube_coordinate_text(), self.terrain) def update_pos(self, instance, value): # Determine the location of the solid hexagon cell. Needs to be offset from the centre of the hex. @@ -76,7 +76,7 @@ class HexMapCell(Label): if super(HexMapCell, self).on_touch_down(touch): return False - coord_x, coord_y = self.map_coordinates() + coord_x, coord_y = self.even_r_coords if not self.visible_on_map: return False @@ -99,7 +99,7 @@ class HexMapCell(Label): radius = 2 * self.height self.ell = Line(circle=(self.x, self.y, radius, 0, 360, 6), width=2) - self.parent.game.update_selected_cell(self.map_coordinates(), self.terrain_colour) + self.parent.game.update_selected_cell(self.even_r_coords, self.terrain_colour) return True def collide_with_bounding_circle(self, coord_x, coord_y): diff --git a/main.py b/main.py index d7ec556..517a89e 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,12 @@ - from kivy import app, properties from kivy.uix.label import Label from kivy.uix.floatlayout import FloatLayout -from kivy.graphics import Color, Ellipse, Line +from kivy.graphics import Color, Ellipse, Line, Rectangle import kivy.utils + + from hexmap import HexMapCell +from terrain import choose_random_terrain, Terrains class StrategyGame(FloatLayout): @@ -59,7 +61,6 @@ class StrategyGame(FloatLayout): # 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) - def update_selected_cell(self, coords, terrain_colour, *args): self.status.text = 'Coords: ({}, {})'.format(coords[0], coords[1]) with self.status.canvas.before: