added restart
This commit is contained in:
@@ -139,6 +139,18 @@ namespace Snake
|
|||||||
public void Die()
|
public void Die()
|
||||||
{
|
{
|
||||||
form.timer.Enabled = false;
|
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)
|
public Color ColorFromHue(float hue)
|
||||||
|
|||||||
Reference in New Issue
Block a user