Exemplo n.º 1
0
        /// <summary>
        /// Creates a new snake on the gameboard at the position defined by the parameters
        /// </summary>
        /// <param name="board"> the board on which to place the snake </param>
        /// <param name="startX"> the starting X position of the snake </param>
        /// <param name="startY"> the starting Y position of the snake </param>
        /// <param name="snakeSpeed">The speed at which the snake will move accross the gameboard</param>
        public Snake(Gameboard board, int startX, int startY, int snakeSpeed)
        {
            //add the first part of the snake to the list
            parts.Add(new Point(startX, startY));

            //used when testing to create a snake of lenght of more than one
            createTest();

            //initialise the board variable and show the snake on the board
            this.board = board;
            this.speed = snakeSpeed;
            show();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initialises the board and snake variables
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Form1_Load(object sender, EventArgs e)
 {
     board = new Gameboard(35, this.gamePanel);
     setup();
 }