Trees | Indices | Toggle frames |
---|
RegularTesselationMap --+ | HexMap
MapLayer with flat-top, regular hexagonal cells.
Calculated attributes:
edge_length -- length of an edge in pixels = int(th / math.sqrt(3)) tw -- with of a "tile" in pixels = edge_length * 2
Hexmaps store their cells in an offset array, column-major with y increasing up, such that a map:
/d\ /h /b\_/f\_/ \_/c\_/g /a\_/e\_/ \_/ \_/
has cells = [['a', 'b'], ['c', 'd'], ['e', 'f'], ['g', 'h']]
(and this the cell at (0, 0) is 'a' and (1, 1) is 'd')
__init__(self, id, th, cells, origin=None, properties=None) | |
get_in_region(self,
x1,
y1,
x2,
y2)
Return cells (in [column][row]) that are within the pixel bounds
specified by the bottom-left (x1, y1) and top-right (x2, y2) corners.
|
|
get_at_pixel(self,
x,
y)
Get the Cell at pixel (x,y).
|
|
get_neighbor(self,
cell,
direction)
Get the neighbor HexCell in the given direction which
is one of self.UP, self.DOWN, self.UP_LEFT, self.UP_RIGHT,
self.DOWN_LEFT or self.DOWN_RIGHT.
|
|
get_neighbors(self,
cell)
Get all neighbor cells for the nominated cell.
|
|
get_cell(self,
i,
j)
Return Cell at cell pos=(i, j).
(Inherited from cocos.tiles.RegularTesselationMap)
|
UP =
|
|
DOWN =
|
|
UP_LEFT =
|
|
UP_RIGHT =
|
|
DOWN_LEFT =
|
|
DOWN_RIGHT =
|
Get the Cell at pixel (x,y).
Return None if out of bounds.
Get the neighbor HexCell in the given direction which is one of self.UP, self.DOWN, self.UP_LEFT, self.UP_RIGHT, self.DOWN_LEFT or self.DOWN_RIGHT.
Return None if out of bounds.
Get all neighbor cells for the nominated cell.
Return a dict with the directions (self.UP, self.DOWN, etc) as keys and neighbor cells as values.
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Wed Jul 07 22:46:54 2010 | http://epydoc.sourceforge.net |