Esempio n. 1
0
        public FormSnakeGame()
        {
            InitializeComponent();

            this.snake = new UISnake(snakeLength, segmentSize, segmentSize, Direction.Right, Pens.Green);

            this.appleGenerator = new UIAppleGenerator(
                this.pictureBoxSnakeGame.Width,
                this.pictureBoxSnakeGame.Height,
                this.appleSize,
                this.appleSize);

            do
            {
                this.apple = this.appleGenerator.CreateApple();
            }while (this.snake.IsOn(apple));

            this.timerSnakeGame.Start();
        }
Esempio n. 2
0
        public FormSnakeGame()
        {
            InitializeComponent();

            this.snake = new UISnake(snakeLength, segmentSize, segmentSize, Direction.Right, Pens.Green);

            this.appleGenerator = new UIAppleGenerator(
                this.pictureBoxSnakeGame.Width,
                this.pictureBoxSnakeGame.Height,
                this.appleSize,
                this.appleSize);

            do
            {
                this.apple = this.appleGenerator.CreateApple();
            }
            while (this.snake.IsOn(apple));

            this.timerSnakeGame.Start();
        }