void InternalCollision(List <Shape> circles) { for (int x = 0; x < circles.Count; x++) { for (int i = 0; i < circles.Count; i++) { if (circles[x].Hitbox.IntersectsWith(circles[i].Hitbox) && x != i) { if (MathForIntersects(circles[x], circles[i])) { if (circles[x].grow == true || circles[i].grow == true) { gameOver = AfterGameScenes.YouLose; //swapping speeds when hitting each other. } else { int tempX = circles[x].speedx; int tempY = circles[i].speedy; circles[x].speedx = circles[i].speedx; circles[x].speedy = circles[i].speedy; circles[i].speedx = tempX; circles[i].speedy = tempY; } } } } } }
public void WinOrLoseChecker() { int totalSize = 0; for (int i = 0; i < Circles.Count; i++) { totalSize += Circles[i].CircleLabelTextValue; } if (totalSize >= 100) { gameOver = AfterGameScenes.YouWin; } switch (gameOver) { case AfterGameScenes.YouLose: timer1.Enabled = false; label2.Text = "you lose "; levelLabel.Text = "playAgain?"; break; case AfterGameScenes.YouWin: timer1.Enabled = false; if (gameLevel >= 10) { label2.Text = "you win the game!"; } else { gameLevel++; label2.Text = "you win "; levelLabel.Text = $"Next Round :{gameLevel}"; startButton.Visible = true; startButton.Enabled = true; startButton.Text = $"Round {gameLevel}"; } break; } }