X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/static/git-logo.png?a=blobdiff_plain;f=new2%2Fplomrogue%2Fmapping.py;h=e0a59d8e225f56af79b0b516bb7f6e366de164a4;hb=1fcb132eabcaa1a95bf2b527dc18c92c15016d2a;hp=f056e105ca57a11d59b45d8451bada77211ef703;hpb=b28833357c0b67e6146e0ac568f5cfd6696f08cd;p=plomrogue2-experiments diff --git a/new2/plomrogue/mapping.py b/new2/plomrogue/mapping.py index f056e10..e0a59d8 100644 --- a/new2/plomrogue/mapping.py +++ b/new2/plomrogue/mapping.py @@ -64,6 +64,38 @@ class MapGeometrySquare(MapGeometryWithLeftRightMoves): +class MapGeometryHex(MapGeometryWithLeftRightMoves): + + def move_UPLEFT(self, start_pos): + start_indented = start_pos.y % 2 + if start_indented: + return YX(start_pos.y - 1, start_pos.x) + else: + return YX(start_pos.y - 1, start_pos.x - 1) + + def move_UPRIGHT(self, start_pos): + start_indented = start_pos.y % 2 + if start_indented: + return YX(start_pos.y - 1, start_pos.x + 1) + else: + return YX(start_pos.y - 1, start_pos.x) + + def move_DOWNLEFT(self, start_pos): + start_indented = start_pos.y % 2 + if start_indented: + return YX(start_pos.y + 1, start_pos.x) + else: + return YX(start_pos.y + 1, start_pos.x - 1) + + def move_DOWNRIGHT(self, start_pos): + start_indented = start_pos.y % 2 + if start_indented: + return YX(start_pos.y + 1, start_pos.x + 1) + else: + return YX(start_pos.y + 1, start_pos.x) + + + class Map(): def __init__(self, map_size):