# How do I use a hex tilemap?

Get help using Construct 2

### » Tue Dec 16, 2014 2:13 pm

Is it possible to use hexes (like http://opengameart.org/content/hexagon-tiles-93x ) in a tilemap? I tried using a negative Y spacing to try and get the tiles to overlap but it doesn't have any effect.

I suppose I could build the map by placing tiles with math. But I want to know what's the best way (development speed, memory usage) to do this.
B
10
S
2
G
2
Posts: 73
Reputation: 1,044

### » Tue Dec 16, 2014 4:39 pm

For the tilemap object, on start of layout loop "with math".
Its pretty much the same as isometric.
B
178
S
50
G
205
Posts: 8,684
Reputation: 127,211

### » Tue Dec 16, 2014 7:52 pm

I guess I'll have to make several copies of the tilemap object to get it to layer properly and do the X offset every other row.
B
10
S
2
G
2
Posts: 73
Reputation: 1,044

### » Tue Dec 16, 2014 10:36 pm

Nope, just one.
You loop over all the xy's and place a tile at the projected coordinates.
screen.x = (map.x - map.y) * TILE_WIDTH_HALF
screen.y = (map.x + map.y) * TILE_HEIGHT_HALF
B
178
S
50
G
205
Posts: 8,684
Reputation: 127,211

### » Tue Dec 16, 2014 11:36 pm

I don't quite understand your expressions. Did you mean

System -> On Layout Start -> Tilemap -> Set tile(Tilemap.PositionToTileX(x), Tilemap.PositionToTileY(y)) to tile Z? But that wouldn't allow placing tiles "inbetween" the normal grid.

Did you mean placing individual sprites?
B
10
S
2
G
2
Posts: 73
Reputation: 1,044

### » Wed Dec 17, 2014 12:41 am

It depends on how you draw the tilemap.
tiemapstart.png

Put that image into a tiled background image, and you might get the idea.
You do not have the required permissions to view the files attached to this post.
B
178
S
50
G
205
Posts: 8,684
Reputation: 127,211