Exemple #1
0
 //this is called only once at the beginning
 static void Init()
 {
     Console.SetWindowSize(100, 40);
     //Console.CursorVisible = false;
     InitGrid();
     DrawGrid();
     player = PlayerSnake.InitSnake();
     InitTimer();
 }
Exemple #2
0
 static public PlayerSnake InitSnake()               //Creating a singleton so that only one snake exists in the world
 {
     if (snakeObject != null)
     {
         return(snakeObject);
     }
     else
     {
         snakeObject = new PlayerSnake();
         return(snakeObject);
     }
 }
Exemple #3
0
        public void defaultValues()
        {
            TheSnake = new PlayerSnake(1);
            TheApple = new Apple();

            gameMap = new Place[PlayRows, PlayColumns];
            for (int i = 0; i < PlayColumns; i++)
            {
                for (int j = 0; j < PlayRows; j++)
                {
                    gameMap[i, j] = new Place(new Position(i, j));
                }
            }
            StartButtonClicked = false;
            applesEaten        = 0;
        }