harshavb / piously-old-ver

Welcome to Piously! This is a hexagonal 1v1 board game.
2 stars 0 forks source link

Create hexagon groups #52

Closed harshavb closed 3 years ago

harshavb commented 3 years ago

Many elements of the game, such as the board, segments of the board, and the local game options background, require a set of hexagons which are connected to each other, with any given hexagon having 0-6 other hexagons connected. Ideally, we want to implement this with optional spacing between the hexagons. Each hexagon group should be a container, so that it's easily rotatable and scalable. The coordinates of each hexagon should be determined solely from the position, rotation, scale, and spacing of the hexagon group. Current idea is to create a coordinate grid based on those variables, and then assign hexagons to the grid as needed. It could be helpful to have a Vector2 offset as well to position the grid offset from the position of the hexagon group itself.

harshavb commented 3 years ago

Creating via HexagonGroup.cs

harshavb commented 3 years ago

Capture Hexagons should be laid out as such.

harshavb commented 3 years ago

I've realized that there are many instances where we want consistent hexagon sizes among differently sized hexagon groups. So, there should be a variable hexagonSize and HexagonSize which determine the size of the overall hexagon group based on the value of the variable. If no value is given for HexagonSize, then the total hexagon group will be sized base on Size alone, with all hexagons fitting inside.

ben9583 commented 3 years ago

Note that regarding the coordinate system, we should consider one that uses constant basis vectors so that we don't need to use if(mod(x, 2) == 1) position.y -= hexagon.height to correct the offset of the hexagons bumping up and down

harshavb commented 3 years ago

Makes sense, switching to that layout instead.

ben9583 commented 3 years ago

The actual grid:

Screen Shot 2020-12-26 at 3 51 18 PM
harshavb commented 3 years ago

Closed by https://github.com/harshavb/piously/commit/6bbba30ed26b27410e50272e6f80a4b4b70691ed