private void timer1_Tick(object sender, EventArgs e) { DaryleMove(); NeganMove(); Rick1Move(); if (rick1.Bounds.IntersectsWith(zombieGirl.Bounds) || negan.Bounds.IntersectsWith(zombieGirl.Bounds) || daryle.Bounds.IntersectsWith(zombieGirl.Bounds)) { timer1.Stop(); scoreBoard.Text = "GAME OVER!"; string name = "Level4"; GameOver go = new GameOver(name); go.Show(); this.Close(); } //if you collect all the brains, this moves you to the second level if (score == 41) { new Scores(score, "level4"); string name = "Level4"; NextLevel nl = new NextLevel(name); nl.Show(); this.Close(); } //score counter and disposes of brains. foreach (PictureBox brain in brainsList) { if (brain.IsDisposed) { } else { if (brain.Bounds.IntersectsWith(zombieGirl.Bounds)) { brain.Dispose(); score++; scoreBoard.Text = $"Score: {score}"; } } } }
private void Timer1_Tick(object sender, EventArgs e) { DaryleMove(); NeganMove(); //if the zombie runs into one of the humans the game is over, can reset if (daryle.Bounds.IntersectsWith(zombie.Bounds) || negan.Bounds.IntersectsWith(zombie.Bounds)) { timer1.Stop(); scoreBoard.Text = "GAME OVER!"; string name = "Level3"; GameOver go = new GameOver(name); go.Show(); this.Close(); } //if you collect all the brains, this moves you to the second level if (score == 28) { new Scores(score, "level3"); string name = "Level3"; NextLevel nl = new NextLevel(name); nl.Show(); this.Close(); } //score counter and disposes of brains foreach (PictureBox brain in brainsList) { if (brain.IsDisposed) { } else { if (brain.Bounds.IntersectsWith(zombie.Bounds)) { brain.Dispose(); score++; scoreBoard.Text = $"Score: {score}"; } } } }