private void New_Game() { mySnake = new snake(); myDirection = new direction(-10, 0); pb_snakeParts = new PictureBox[0]; for (int i = 0; i < 3; i++) { Array.Resize(ref pb_snakeParts, pb_snakeParts.Length + 1); pb_snakeParts[i] = pb_add(); } timer1.Start(); button1.Enabled = false; }
public void Move(direction direction) { direct = direction; if (direction._x == 0 && direction._y == 0) { } else { for (int i = snake_part.Length - 1; i > 0; i--) { snake_part[i] = new snake_parts(snake_part[i - 1].x_, snake_part[i - 1].y_); } snake_part[0] = new snake_parts(snake_part[0].x_ + direction._x, snake_part[0].y_ + direction._y); } }