Example #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            SnakeScoreLabel.Text = Convert.ToString(score);

            if (down)
            {
                snake.moveDown();
            }
            if (up)
            {
                snake.moveUp();
            }
            if (right)
            {
                snake.moveRight();
            }
            if (left)
            {
                snake.moveLeft();
            }
            for (int i = 0; i < snake.SnakeRec.Length; i++)
            {
                if (snake.SnakeRec[i].IntersectsWith(food.punktyRec))
                {
                    score += 10;
                    snake.growSnake();
                    food.PunktyLokacja(randPunkty);
                }
            }
            kolizja();

            this.Invalidate();
        }
Example #2
0
 public void changeFoodLocation()
 {
     snake.growSnake();
     food.placeFood(r);
 }