Replaced for-loop with while-loop as main loop
Implemented end-game condition triggered by pressing ESC
This commit is contained in:
parent
256a05b930
commit
1ae55c0484
@ -10,11 +10,12 @@
|
||||
Right
|
||||
}
|
||||
|
||||
private static bool _running = true;
|
||||
private static Direction _direction = Direction.Up;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.SetCursorPosition(Console.WindowWidth/2, Console.WindowHeight/2);
|
||||
for(int i = 1; ;++i)
|
||||
while(_running)
|
||||
{
|
||||
HandleInput();
|
||||
ProcessMovement();
|
||||
@ -70,6 +71,9 @@
|
||||
case ConsoleKey.D:
|
||||
_direction = Direction.Right;
|
||||
break;
|
||||
case ConsoleKey.Escape:
|
||||
_running = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user