# HexaHover

HexaHover was our entry for the Ludum Dare Gamejam 38. We made this over the course of 3 days, and sent it in as an entry. It’s a simple local multiplayer game where the players have to try to bump each other off the map, while trying to avoid falling off yourself. The controls are really simple, you steer with the joystick, you accelerate with RT, and you boost with A. It’s also possible to play with the keyboard, but we recommend using a controller.

## My responsibilities

Since this was a 3-day project, I was involved in most of the programming, as we only had 2 programmers in total. The other programmer focused more on the player movement, while I tackled the arena, and score management. Most things were done together though.

## Lessons learned

This project was a nice way to learn how to work under pressure as we worked 12+ hours a day, with no breaks in between. On top of that, it was also crucial that we estimated what we could make in 3 days, and cutting features where necessary to hit that time-mark. Overall, this was a very fun side project.

## Code Snippets

``` private void GenerateHexagon(int radius)
{
Quaternion rot = Quaternion.Euler(-90, 0, 0);

//Generate middle bar
int middleBar = (radius * 2) - 1;
float middleBarXOffset = middleBar;
for (int column = 0; column < middleBar; column++)
{
Vector3 pos = new Vector3(0, -HexagonHeight, zOffset);
GameObject t = Instantiate(HexagonPrefab, pos, rot);
t.transform.parent = this.transform;
}

//Generate bottom bar
for (int row = 1; row < radius; row++)
{
bool newRow = false;
while (!newRow)
{
for (int column = 0; column < radiusBar; column++)
{
float xOffset = (row * ((HexagonRadius * Mathf.Sqrt(3)) / 2));
Vector3 pos = new Vector3(xOffset, -HexagonHeight, zOffset);
GameObject t = Instantiate(HexagonPrefab, pos, rot);
t.transform.parent = this.transform;
{
newRow = true;
}
}
}
}

//Generate top bar
for (int row = 1; row < radius; row++)
{
bool newRow = false;
while (!newRow)
{
for (int column = 0; column < radiusBar; column++)
{
float zOffset = (column * HexagonRadius) - middleBarXOffset + ((HexagonRadius / 2f) * row) + HexagonRadius / 2f;
float xOffset = (-row * ((HexagonRadius * Mathf.Sqrt(3)) / 2));
Vector3 pos = new Vector3(xOffset, -HexagonHeight, zOffset);
GameObject t = Instantiate(HexagonPrefab, pos, rot);
t.transform.parent = this.transform;
if (column >= radiusBar - 1)
{
newRow = true;
}
}
}
}
```
```    public void SpawnEndcreen()
{
//GameManager.Players.Sort(Compare);
var players = GameManager.Players;
players.Sort(Compare);
players.Reverse();

GetComponent<Canvas>().enabled = true;
FindObjectOfType<Score_UI>().gameObject.GetComponent<Canvas>().enabled = false;

float panelHeight = (Prefab.GetComponent<RectTransform>().rect.height);
float panelWidth = (Prefab.GetComponent<RectTransform>().rect.width / 2);

foreach (GameManager.PlayerInfo p in players)
{
GameObject panel = Instantiate(Prefab);
panel.transform.parent = this.transform;
panel.GetComponent<Image>().color = p.Color;
Score_UI.PanelInfo pi;
pi.PlayerNumber = p.Number;
pi.Panel = panel;
}

for (int i = 0; i < _panels.Count; i++)
{
_panels[i].Panel.GetComponent<RectTransform>().anchoredPosition = Vector3.zero +
new Vector3(0,
-(panelHeight * i) -
(panelHeight / 2f), 0) +
new Vector3(Offset.x, Offset.y, 0);
}
}
```