Exemplo n.º 1
0
        // Set random location for food
        private void RandomizeFood()
        {
            // Loop while the food is not on empty cell
            while (GetScreenPixel(foodX, foodY) != Pixel.Presets.Black)
            {
                // Set food to random point
                foodX = Random(ScreenWidth);
                foodY = Random(ScreenHeight);
            }

            snakeCharacter.updateFoodCoords(foodX, foodY);
        }