Hex Grid (Sorry if Duplicate Q)

For questions about using Classic.

Post » Thu Sep 01, 2011 4:55 am

I can't figure out how to setup a Hex Grid.

I have a tiled background with a hex grid and I want a sprite (the mouse cursor) to snap to the grid. If it's a simple square grid it'd be easy.

But my mind is failing me for a hex grid.

Any help?
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049

Post » Thu Sep 01, 2011 6:31 am

A hexgrid is basically a square grid with odd rows offset by half cell width. You can do that by using modulus, so you just add 'half width' multiplied by the 'row index' mod '2', to the X coordinates.

here's a cap:
http://dl.dropbox.com/u/7871870/construct/hexgrid-01.cap

*Edit: if you want a more precise solution I found some links for reference:
http://playtechs.blogspot.com/2007/04/hex-grids.html
http://gdreflections.com/2011/02/hexagonal-grid-math.html
http://www-cs-students.stanford.edu/~amitp/gameprog.html#hexAnimmaniac2011-09-01 19:55:06
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Tue Feb 28, 2012 10:27 am

@Animmaniac

Thanks, I had made a hex board plugin(C2) from your cap file.
B
97
S
22
G
178
Posts: 4,119
Reputation: 104,045

Post » Mon May 07, 2012 7:25 am

@Animmaniac

I had released hex grid plugin on this post.rexrainbow2012-05-07 07:25:17
B
97
S
22
G
178
Posts: 4,119
Reputation: 104,045

Post » Mon May 07, 2012 1:30 pm

Nice rexrainbow! Thanks for letting me know.
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests