Пример #1
0
 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
 def get_tile_bottomright(self, x, y, z):
     odd=spc_mod(y, 2)
     return x, y+2, z
Пример #3
0
 def get_tile_topright(self, x, y, z):
     odd=spc_mod(y, 2)
     return x+1, y, z
Пример #4
0
 def get_tile_bottomleft(self, x, y, z):
     odd=spc_mod(y, 2)
     return x-1, y, z
Пример #5
0
 def get_tile_topleft(self, x, y, z):
     odd=spc_mod(y, 2)
     return x, y-2, z
Пример #6
0
 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
 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
 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
 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