예제 #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