private void ThirdLevel(int barrierPic) { System.Threading.Thread.Sleep(1000); // Listen leeren snake.Clear(); Apples.ClearBarrierList(); Apples.ClearSnakePartsList(); playground.Children.Clear(); AddSnake(); myGrid.Background = new SolidColorBrush(Color.FromRgb(231, 220, 124)); BorderColor = Color.FromRgb(119, 162, 215); DrawPlayground(); GameBreak(); PlaceBarriers(barrierPic); myApple.ShowApple(playground, pillarWidth); }
// Methode fuer den Start des Spiels private void Start() { // Geschwindigkeit setzen speedSnake = 1000; timerSnake.Interval = TimeSpan.FromMilliseconds(speedSnake); gamePoints.LoeschePunkte(); ProgressBarSpeed.Value = 0; ProgressBarLife.Value = 0; // Listen leeren snake.Clear(); if (gameStarted) { Apples.ClearBarrierList(); Apples.ClearSnakePartsList(); } // Spielfeld leeren playground.Children.Clear(); points = 0; time = 0; direction = 0; showPoints.Content = points; showTime.Content = time; gameStarted = true; _counterLevel = 1; NextLevel(); // Einstellungen deaktivieren MenuEasy.IsEnabled = false; MenuAvarage.IsEnabled = false; MenuHeavy.IsEnabled = false; // ersten Apfel setzen myApple = new Apples(appleSize); myApple.ShowApple(playground, pillarWidth); ProgressBarLife.Value = 3; levelPoints = 400; }