Ejemplo n.º 1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < SnakeInstance.GridSize; i++)
            {
                for (int j = 0; j < SnakeInstance.GridSize; j++)
                {
                    snake.MapColor[i, j] = Color.White;
                }
            }

            score              = 0;
            richTextBox2.Text  = score.ToString();
            startGame          = true;
            difficultySelected = false;

            button2.Visible      = true;
            button4.Visible      = true;
            button5.Visible      = true;
            richTextBox1.Visible = false;
            richTextBox2.Visible = false;
            richTextBox3.Visible = false;
            richTextBox4.Visible = false;
            difficultySelected   = false;
            richTextBox5.Visible = false;
            button1.Visible      = false;

            snake = new SnakeInstance("RIGHT");
        }
Ejemplo n.º 2
0
        // Default constructor
        public Snake()
        {
            difficultySelected = false;
            snake = new SnakeInstance("RIGHT");

            score     = 0;
            startGame = true;

            // initializing the starting position of the snake
            InitializeComponent();

            timer1.Tick += Timer1_Tick;
        }