Advertisement

hex grid

Started by February 13, 2025 11:26 PM
1 comment, last by NubDevice 1 week, 1 day ago

I am making a strategy board game which uses hexes for movement. I want my sprites which already move to snap to the hex grid when they move using the mouse. They are flat topped hexes. Here is their movement formulas.

horiz=¾*width=3/2*size

vert=height=sqrt(3)*size

Ignore those. That's not your speed and your hex grid is not flat top. They are pointed top.
Joe has given you a simplified approach. http://gamedev.net/forums/topic/717858-click-and-drag-sprite/5468521/?page=6

Those formulas are for a group of individuals of a different caliper.
Hexagonal Grid Traversal - 3D
Remember the name of that shader author if you've never heard of him before.

Focus on getting your game to work in the simplest to understand ways possible.
Code duplication and global variables are your weak points right now.
Separating to function is the lesson that you seem to be resisting.
Designing structures to describe your objects is what you're currently being shown.
Take that in for now. You are being guided by an individual that understands the internals deep within the hardware.
To ignore the opportunity being gifted to you right now will be the worst mistake ever.

Dev careful. Pixel on board.
Buckle up. Everything will be revealed.

Advertisement