Struggling to setup a hex-shaped grid #108
Unanswered
kirkbushell
asked this question in
Q&A
Replies: 1 comment 4 replies
-
lol I think I've just figured it out. Basically because I'm generating the hexes as part of a separate system, I can literally pass these hexes as an array to the grid, and it'll render it exactly as I'd expect. Ie. I just did this: const grid = new Grid(Hex, [
{q: 0, r: 0},
{q: 0, r: -1},
{q: 1, r: -1},
{q: 1, r: 0},
{q: 0, r: 1},
{q: -1, r: 1},
{q: -1, r: 0},
]) And it created a hexagon with 7 hexes. Now I'm just trying to figure out why it's so far off the canvas.... |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Have been reading the docs past few nights and I'm at a bit of a loss (just not smart enough I guess). In the docs at redblobgames: https://www.redblobgames.com/grids/hexagons/#coordinates
Under axial coordinates (which seems superior from a space storage perspective), he goes into details and uses a hexmap where 0,0 is the center and goes out from there.
I'm trying to achieve a similar sort of thing using honeycomb (great package name, btw!) to construct a grid of that nature. I followed the docs, and closest I could get was using a rectangle grid with a spiral traversal, but this just doesn't seem right.
I'm positive I need to create a grid specifically, and not really need traversal (if I understand it correctly), and pass that grid to my renderer, but I'm a bit lost as to how exactly that can function.
Help?!
Beta Was this translation helpful? Give feedback.
All reactions