Answer the question
In order to leave comments, you need to log in
How to fix the program - a snake?
Hello.
After reading the book, I decided to repeat the project - the snake program, only in c#. I am doing this lesson https://itproger.com/course/cpp-snake . Why doesn't this design work?
Declared like this:
public enum eDirection { STOP = 0, LEFT, RIGHT, UP, DOWN };
public eDirection dir;
static void Input()
{
if (Console.KeyAvailable)
{
var keyInfo = Console.ReadKey();
switch (keyInfo.KeyChar)
{
case 'a':
dir = LEFT;
break;
case 'd':
dir = RIGHT;
break;
case 'w':
dir = UP;
break;
case 's':
dir = DOWN;
case 'x':
gameOver = true;
break;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question