added restart

This commit is contained in:
max
2026-02-04 20:32:52 +01:00
parent c09428bb31
commit c5b06a11d1

View File

@@ -139,6 +139,18 @@ namespace Snake
public void Die()
{
form.timer.Enabled = false;
Restart();
}
public void Restart()
{
form.timer.Enabled = true;
Cell startCell = new Cell(10, 10, CellTypes.Snake);
map = new Map(mapSize, mapSize);
map.SetCell(startCell);
worm = new Worm(startCell);
startCell.Color = ColorFromHue(0f);
SpawnApple();
}
public Color ColorFromHue(float hue)