# Class cocos.tiles.HexMapLayer

              RegularTesselationMap --+
                                      |
                                 HexMap --+
                                          |
        cocosnode.CocosNode --+           |
                              |           |
    scene.EventHandlerMixin --+           |
                              |           |
        layer.base_layers.Layer --+       |
                                  |       |
    layer.scrolling.ScrollableLayer --+   |
                                      |   |
                               MapLayer --+
                                          |
                                         HexMapLayer

A renderable, scrollable hex map.

The Layer has a calculated attribute:

> 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']]

## Methods

| __init__(self, id, th, cells, origin=None, properties=None)
| __contains__(self, key) (Inherited from cocos.tiles.MapLayer)
| __getitem__(self, key) (Inherited from cocos.tiles.MapLayer)
| __setitem__(self, key, value) (Inherited from cocos.tiles.MapLayer)
CocosNode instance | add(self, child, z=0, name=None) Adds a child and if it becomes part of the active scene calls its on_enter method (Inherited from cocos.cocosnode.CocosNode)
| are_actions_running(self) Determine whether any actions are running. (Inherited from cocos.cocosnode.CocosNode)
Action instance | do(self, action, target=None) Executes an action. (Inherited from cocos.cocosnode.CocosNode)
| draw(self) This is the function you will have to override if you want your subclassed to draw something on screen. (Inherited from cocos.layer.scrolling.ScrollableLayer)
| find_cells(self, **requirements) Find all cells that match the properties specified. (Inherited from cocos.tiles.MapLayer)
CocosNode | get(self, key, default=None) Gets a child given its name (Inherited from cocos.tiles.MapLayer)
CocosNode or None | get_ancestor(self, klass) Walks the nodes tree upwards until it finds a node of the class `klass` or returns None (Inherited from cocos.cocosnode.CocosNode)
| get_at_pixel(self, x, y) Get the Cell at pixel (x,y). (Inherited from cocos.tiles.HexMap)
| get_cell(self, i, j) Return Cell at cell pos=(i, j). (Inherited from cocos.tiles.RegularTesselationMap)
list of CocosNode | get_children(self) Return a list with the node's childs, order is back to front (Inherited from cocos.cocosnode.CocosNode)
| 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. (Inherited from cocos.tiles.HexMap)
euclid.Matrix3 | get_local_inverse(self) returns an euclid.Matrix3 with the local inverse transformation matrix (Inherited from cocos.cocosnode.CocosNode)
euclid.Matrix3 | get_local_transform(self) returns an euclid.Matrix3 with the local transformation matrix (Inherited from cocos.cocosnode.CocosNode)
| 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. (Inherited from cocos.tiles.HexMap)
| get_neighbors(self, cell) Get all neighbor cells for the nominated cell. (Inherited from cocos.tiles.HexMap)
| get_visible_cells(self) Given the current view in map-space pixels, transform it based on the current screen-space transform and figure the region of map-space pixels currently visible. (Inherited from cocos.tiles.MapLayer)
euclid.Matrix3 | get_world_inverse(self) returns an euclid.Matrix3 with the world inverse transformation matrix (Inherited from cocos.cocosnode.CocosNode)
euclid.Matrix3 | get_world_transform(self) returns an euclid.Matrix3 with the world transformation matrix (Inherited from cocos.cocosnode.CocosNode)
| is_visible(self, rect) Determine whether the indicated rect (with .x, .y, .width and .height attributes) located in this Layer is visible. (Inherited from cocos.tiles.MapLayer)
| kill(self) Remove this object from its parent, and thus most likely from everything. (Inherited from cocos.cocosnode.CocosNode)
| on_cocos_resize(self, usable_width, usable_height) (Inherited from cocos.layer.scrolling.ScrollableLayer)
| on_enter(self) Called every time just before the node enters the stage. (Inherited from cocos.layer.scrolling.ScrollableLayer)
| on_exit(self) Called every time just before the node leaves the stage (Inherited from cocos.layer.base_layers.Layer)
| pause(self) Suspends the execution of actions. (Inherited from cocos.cocosnode.CocosNode)
| pause_scheduler(self) Time will stop passing for this node: scheduled callbacks will not be called, worker actions will not be called (Inherited from cocos.cocosnode.CocosNode)
euclid.Vector2 | point_to_local(self, p) returns an euclid.Vector2 converted to local space (Inherited from cocos.cocosnode.CocosNode)
euclid.Vector2 | point_to_world(self, p) returns an euclid.Vector2 converted to world space (Inherited from cocos.cocosnode.CocosNode)
| push_all_handlers(self) registers itself to receive director.window events and propagates the call to childs that are layers. (Inherited from cocos.layer.base_layers.Layer)
| remove(self, obj) Removes a child given its name or object (Inherited from cocos.cocosnode.CocosNode)
| remove_action(self, action) Removes an action from the node actions container, potentially calling action.stop() (Inherited from cocos.cocosnode.CocosNode)
| remove_all_handlers(self) de-registers itself to receive director.window events and propagates the call to childs that are layers. (Inherited from cocos.layer.base_layers.Layer)
| resume(self) Resumes the execution of actions. (Inherited from cocos.cocosnode.CocosNode)
| resume_scheduler(self) Time will continue/start passing for this node and callbacks will be called, worker actions will be called (Inherited from cocos.cocosnode.CocosNode)
| schedule(self, callback, *args, **kwargs) Schedule a function to be called every frame. (Inherited from cocos.cocosnode.CocosNode)
| schedule_interval(self, callback, interval, *args, **kwargs) Schedule a function to be called every `interval` seconds. (Inherited from cocos.cocosnode.CocosNode)
| set_cell_color(self, i, j, color) (Inherited from cocos.tiles.MapLayer)
| set_cell_opacity(self, i, j, opacity) (Inherited from cocos.tiles.MapLayer)
| set_debug(self, debug) (Inherited from cocos.tiles.MapLayer)
| set_dirty(self) The viewport has changed in some way. (Inherited from cocos.tiles.MapLayer)
| set_view(self, x, y, w, h, viewport_x=0, viewport_y=0) (Inherited from cocos.tiles.MapLayer)
| stop(self) Removes all actions from the running action list (Inherited from cocos.cocosnode.CocosNode)
| transform(self) Apply ModelView transformations (Inherited from cocos.cocosnode.CocosNode)
| unschedule(self, callback) Remove a function from the schedule. (Inherited from cocos.cocosnode.CocosNode)
| visit(self) This function visits it's children in a recursive way. (Inherited from cocos.cocosnode.CocosNode)
list | walk(self, callback, collect=None) Executes callback on all the subtree starting at self. (Inherited from cocos.cocosnode.CocosNode)

## Properties

(int,int) | anchor Anchor point of the object. (Inherited from cocos.cocosnode.CocosNode)
(int,int) | anchor_x Anchor x value for transformations and adding children (Inherited from cocos.cocosnode.CocosNode)
(int,int) | anchor_y Anchor y value for transformations and adding children (Inherited from cocos.cocosnode.CocosNode)
object | parent The parent of this object. (Inherited from cocos.cocosnode.CocosNode)
(int, int) | position The (x, y) coordinates of the object. (Inherited from cocos.cocosnode.CocosNode)
| rotation (Inherited from cocos.cocosnode.CocosNode)
| scale (Inherited from cocos.cocosnode.CocosNode)
(int,int) | transform_anchor Transformation anchor point. (Inherited from cocos.cocosnode.CocosNode)
| x The x coordinate of the object (Inherited from cocos.cocosnode.CocosNode)
| y The y coordinate of the object (Inherited from cocos.cocosnode.CocosNode)

## Instance Variables

| actions list of Action objects that are running (Inherited from cocos.cocosnode.CocosNode)
| camera eye, center and up vector for the Camera. (Inherited from cocos.cocosnode.CocosNode)
| children list of (int, child-reference) where int is the z-order, sorted by ascending z (back to front order) (Inherited from cocos.cocosnode.CocosNode)
| children_names dictionary that maps children names with children references (Inherited from cocos.cocosnode.CocosNode)
| grid the grid object for the grid actions. (Inherited from cocos.cocosnode.CocosNode)
| is_running whether of not the object is running (Inherited from cocos.cocosnode.CocosNode)
| scheduled_calls list of scheduled callbacks (Inherited from cocos.cocosnode.CocosNode)
| scheduled_interval_calls list of scheduled interval callbacks (Inherited from cocos.cocosnode.CocosNode)
| skip_frame whether or not the next frame will be skipped (Inherited from cocos.cocosnode.CocosNode)
| to_remove list of Action objects to be removed (Inherited from cocos.cocosnode.CocosNode)
| transform_anchor_x offset from (x,0) from where rotation and scale will be applied. (Inherited from cocos.cocosnode.CocosNode)
| transform_anchor_y offset from (0,y) from where rotation and scale will be applied. (Inherited from cocos.cocosnode.CocosNode)
| visible whether of not the object is visible. (Inherited from cocos.cocosnode.CocosNode)

## Class Variables

| debug = `False` (Inherited from cocos.tiles.MapLayer)
| is_event_handler = `False` if True the layer will listen to director.window events Default: False if true, the event handlers of this layer will be registered. (Inherited from cocos.layer.base_layers.Layer)
| origin_x = `0` (Inherited from cocos.layer.scrolling.ScrollableLayer)
| origin_y = `0` (Inherited from cocos.layer.scrolling.ScrollableLayer)
| origin_z = `0` (Inherited from cocos.layer.scrolling.ScrollableLayer)
| view_h = `0` (Inherited from cocos.layer.scrolling.ScrollableLayer)
| view_w = `0` (Inherited from cocos.layer.scrolling.ScrollableLayer)
| view_x = `0` (Inherited from cocos.layer.scrolling.ScrollableLayer)
| view_y = `0` (Inherited from cocos.layer.scrolling.ScrollableLayer)

## Constants

| DOWN = ``'``down``'`` (Inherited from cocos.tiles.HexMap)
| DOWN_LEFT = ``'``down left``'`` (Inherited from cocos.tiles.HexMap)
| DOWN_RIGHT = ``'``down right``'`` (Inherited from cocos.tiles.HexMap)
| UP = ``'``up``'`` (Inherited from cocos.tiles.HexMap)
| UP_LEFT = ``'``up left``'`` (Inherited from cocos.tiles.HexMap)
| UP_RIGHT = ``'``up right``'`` (Inherited from cocos.tiles.HexMap)

## Method Details

### __init__

(Constructor) __init__(self, id, th, cells, origin=None, properties=None)

Overrides:
  HexMap.__init__