private void gameloop_Tick(object sender, EventArgs e) { // update location of bubbles foreach (bubble b in left) { b.Move(5); } foreach (bubble b in right) { b.Move(-5); } BubbleTimer++; if (BubbleTimer == 20) { MakeBubble(); } if (player1Score == gameWinScore) { win.Play(); GameWin(); } // controlling rocket if (leftArrowDown == true && hero.y > 0) { hero.Move(heroSpeed, false); } if (rightArrowDown == true && hero.y < this.Width - heroSize) { hero.Move(heroSpeed, true); } if (upArrowDown == true) { hero.MoveY(heroSpeed, false); } if (downArrowDown == true) { hero.MoveY(heroSpeed, true); } if (upArrowDown == true && hero.y < 0) { hero.y = this.Height; player1Score++; scoreLabel.Text = player1Score + ""; } Rectangle heroRec = new Rectangle(hero.x, hero.y, hero.size, hero.size); foreach (bubble b in left) { Rectangle boxRec = new Rectangle(b.x, b.y, b.size, b.size); if (heroRec.IntersectsWith(boxRec)) { gameloop.Enabled = false; boo.Play(); GameOver(); return; } } foreach (bubble b in right) { Rectangle boxRec = new Rectangle(b.x, b.y, b.size, b.size); if (heroRec.IntersectsWith(boxRec)) { gameloop.Enabled = false; boo.Play(); GameOver(); return; } } Refresh(); }