コード例 #1
0
ファイル: grid.py プロジェクト: AjaxVM/pyglibs
 def convert_map_pos(self, x, y, z):
     """takes 3 coordinates, and converts them to pixels to be displayed on the screen.
        aligns pixels to fit diamond shaped tiles, aligns to "square" grid,
        ie(the corners for the corners of the screen, easier to take out black areas around
        edges of screen - just lock a camera left/right to tile_size[0]/2
        and top/bottom to tile_size[1]/2"""
     s1, s2, s3 = self.tx, self.ty, self.tz
     odd=spc_mod(y, 2)
     cx=x*s1
     cy=y*s2/2
     if odd:cx+=s2
     return int(cx), int(cy)
コード例 #2
0
ファイル: grid.py プロジェクト: AjaxVM/pyglibs
 def get_tile_bottomright(self, x, y, z):
     odd=spc_mod(y, 2)
     return x, y+2, z
コード例 #3
0
ファイル: grid.py プロジェクト: AjaxVM/pyglibs
 def get_tile_topright(self, x, y, z):
     odd=spc_mod(y, 2)
     return x+1, y, z
コード例 #4
0
ファイル: grid.py プロジェクト: AjaxVM/pyglibs
 def get_tile_bottomleft(self, x, y, z):
     odd=spc_mod(y, 2)
     return x-1, y, z
コード例 #5
0
ファイル: grid.py プロジェクト: AjaxVM/pyglibs
 def get_tile_topleft(self, x, y, z):
     odd=spc_mod(y, 2)
     return x, y-2, z
コード例 #6
0
ファイル: grid.py プロジェクト: AjaxVM/pyglibs
 def get_tile_bottom(self, x, y, z):
     odd=spc_mod(y, 2)
     if odd:return x, y+1, z
     return x-1, y+1, z
コード例 #7
0
ファイル: grid.py プロジェクト: AjaxVM/pyglibs
 def get_tile_top(self, x, y, z):
     odd=spc_mod(y, 2)
     if odd:return x+1, y-1, z
     else:return x, y-1, z
コード例 #8
0
ファイル: grid.py プロジェクト: AjaxVM/pyglibs
 def get_tile_right(self, x, y, z):
     odd=spc_mod(y, 2)
     if odd:return x+1, y+1, z
     else:return x, y+1, z
コード例 #9
0
ファイル: grid.py プロジェクト: AjaxVM/pyglibs
 def get_tile_left(self, x, y, z):
     odd=spc_mod(y, 2)
     if odd:
         return x, y-1, z
     return x-1, y-1, z