コード例 #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();
        }
コード例 #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();
        }