Merge remote-tracking branch 'remotes/amy/llfkj'

# Conflicts:
#	hexmap.py
#	main.py
This commit is contained in:
Dorian 2016-07-16 23:59:28 -04:00
parent a71edbe29b
commit 18bb30c971
2 changed files with 7 additions and 6 deletions

View File

@ -53,7 +53,7 @@ class HexMapCell(Label):
return '{}\n{}\n{}'.format(*self.cube_coords) return '{}\n{}\n{}'.format(*self.cube_coords)
def map_display_text(self): 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): def update_pos(self, instance, value):
# Determine the location of the solid hexagon cell. Needs to be offset from the centre of the hex. # 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): if super(HexMapCell, self).on_touch_down(touch):
return False return False
coord_x, coord_y = self.map_coordinates() coord_x, coord_y = self.even_r_coords
if not self.visible_on_map: if not self.visible_on_map:
return False return False
@ -99,7 +99,7 @@ class HexMapCell(Label):
radius = 2 * self.height radius = 2 * self.height
self.ell = Line(circle=(self.x, self.y, radius, 0, 360, 6), width=2) 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 return True
def collide_with_bounding_circle(self, coord_x, coord_y): def collide_with_bounding_circle(self, coord_x, coord_y):

View File

@ -1,10 +1,12 @@
from kivy import app, properties from kivy import app, properties
from kivy.uix.label import Label from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout from kivy.uix.floatlayout import FloatLayout
from kivy.graphics import Color, Ellipse, Line from kivy.graphics import Color, Ellipse, Line, Rectangle
import kivy.utils import kivy.utils
from hexmap import HexMapCell from hexmap import HexMapCell
from terrain import choose_random_terrain, Terrains
class StrategyGame(FloatLayout): 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. # 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) hex_cell.bind(pos=hex_cell.update_pos, size=hex_cell.update_pos)
def update_selected_cell(self, coords, terrain_colour, *args): def update_selected_cell(self, coords, terrain_colour, *args):
self.status.text = 'Coords: ({}, {})'.format(coords[0], coords[1]) self.status.text = 'Coords: ({}, {})'.format(coords[0], coords[1])
with self.status.canvas.before: with self.status.canvas.before: