public IFood CreateNewFood(int count, PictureBox gameArena, bool checkIfTime) { IFood _newFood; if (count % 8 == 0 && checkIfTime == true) { _newFood = _timerFood; progressBarChange.SetProgressBarOn(); } else { _newFood = _normalFood; progressBarChange.SetProgressBarOff(); } _newFood.SetNewCoordinates(gameArena); return(_newFood); }
void InitializeObjects() { labGameOver.Visible = false; labScore.Text = Score.ToString(); MessageBox.Show("Game will begin after you close this window", "Good luck!"); snake = new Snake(new Circle(2, 10, Brushes.Black)); progress = new ProgressBarChanges(progressTime, labProgress); factoryFood = new FactoryFood(progressTime, progress); newFood = new NormalFood(10, 5, Brushes.Red); progress.SetProgressBarOff(); // START OF THE TIMER GameTimer.Tick += UpdateScreen; GameTimer.Interval = 100; GameTimer.Start(); }