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