示例#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