diff --git a/Csharp/Gokspel/Program.cs b/Csharp/Gokspel/Program.cs index 8e3a12e..15543ee 100644 --- a/Csharp/Gokspel/Program.cs +++ b/Csharp/Gokspel/Program.cs @@ -16,32 +16,39 @@ class Program : Form public Program() { + // Initialize the random number to guess numberToGuess = random.Next(1, 101); + // Set up the form this.Text = "Gokspel"; this.Size = new System.Drawing.Size(300, 200); + // Create and add the prompt label Label promptLabel = new Label(); promptLabel.Text = "Raad het getal tussen 1 en 100:"; promptLabel.Location = new System.Drawing.Point(10, 20); promptLabel.AutoSize = true; this.Controls.Add(promptLabel); + // Create and add the input box inputBox = new TextBox(); inputBox.Location = new System.Drawing.Point(10, 50); this.Controls.Add(inputBox); + // Create and add the guess button guessButton = new Button(); guessButton.Text = "Gok"; guessButton.Location = new System.Drawing.Point(10, 80); guessButton.Click += new EventHandler(GuessButton_Click); this.Controls.Add(guessButton); + // Create and add the result label resultLabel = new Label(); resultLabel.Location = new System.Drawing.Point(10, 110); resultLabel.AutoSize = true; this.Controls.Add(resultLabel); + // Create and add the restart button (initially hidden) restartButton = new Button(); restartButton.Text = "Opnieuw"; restartButton.Location = new System.Drawing.Point(10, 140); @@ -49,6 +56,7 @@ class Program : Form restartButton.Visible = false; this.Controls.Add(restartButton); + // Set up the confetti timer confettiTimer = new System.Windows.Forms.Timer(); confettiTimer.Interval = 30; confettiTimer.Tick += new EventHandler(ConfettiTimer_Tick); @@ -71,7 +79,7 @@ class Program : Form { resultLabel.Text = "Gefeliciteerd! Je hebt het juiste getal geraden."; StartConfetti(); - restartButton.Visible = true; + restartButton.Visible = true; // Show the restart button } } else @@ -82,17 +90,19 @@ class Program : Form private void RestartButton_Click(object sender, EventArgs e) { + // Reset the game numberToGuess = random.Next(1, 101); resultLabel.Text = ""; inputBox.Text = ""; confettiList.Clear(); confettiTimer.Stop(); - restartButton.Visible = false; + restartButton.Visible = false; // Hide the restart button this.Invalidate(); } private void StartConfetti() { + // Initialize confetti confettiList.Clear(); for (int i = 0; i < 100; i++) { @@ -103,6 +113,7 @@ class Program : Form private void ConfettiTimer_Tick(object sender, EventArgs e) { + // Update confetti positions for (int i = 0; i < confettiList.Count; i++) { confettiList[i].Update(); @@ -113,6 +124,7 @@ class Program : Form protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); + // Draw confetti foreach (var confetti in confettiList) { e.Graphics.FillEllipse(new SolidBrush(confetti.Color), confetti.Position.X, confetti.Position.Y, confetti.Size, confetti.Size); @@ -137,6 +149,7 @@ class Confetti public Confetti(Random random, Size clientSize) { + // Initialize confetti properties Position = new PointF(random.Next(clientSize.Width), random.Next(clientSize.Height)); SpeedY = (float)(random.NextDouble() * 2 + 1); SpeedX = (float)(random.NextDouble() * 2 - 1); @@ -146,6 +159,7 @@ class Confetti public void Update() { + // Update confetti position and apply gravity Position = new PointF(Position.X + SpeedX, Position.Y + SpeedY); SpeedY += 0.1f; // gravity effect } diff --git a/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.dll b/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.dll index ded7343..cb02793 100644 Binary files a/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.dll and b/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.dll differ diff --git a/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.exe b/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.exe index 9ffac71..e2c1a1f 100644 Binary files a/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.exe and b/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.exe differ diff --git a/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.pdb b/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.pdb index 80e2764..36dc248 100644 Binary files a/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.pdb and b/Csharp/Gokspel/bin/Debug/net9.0-windows/Gokspel.pdb differ diff --git a/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.AssemblyInfo.cs b/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.AssemblyInfo.cs index c8469af..583ffae 100644 --- a/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.AssemblyInfo.cs +++ b/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Gokspel")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5e0e0a7907fee55389f89acc2c73bf9b341ddcaa")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a612e37e825def883bfd7fe26fc57829939c8f7c")] [assembly: System.Reflection.AssemblyProductAttribute("Gokspel")] [assembly: System.Reflection.AssemblyTitleAttribute("Gokspel")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.AssemblyInfoInputs.cache b/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.AssemblyInfoInputs.cache index ed0bb5b..586f5d7 100644 --- a/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.AssemblyInfoInputs.cache +++ b/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.AssemblyInfoInputs.cache @@ -1 +1 @@ -c9244a4ee0444c03cc63d0bf7d904d54d44cbc174ca7623827c8d17875284eed +c5d086a89aa6b0df3b5af5d9db4cb515ec3bb0d006057a034554e4bce0e84345 diff --git a/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.dll b/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.dll index ded7343..cb02793 100644 Binary files a/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.dll and b/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.dll differ diff --git a/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.pdb b/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.pdb index 80e2764..36dc248 100644 Binary files a/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.pdb and b/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.pdb differ diff --git a/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.sourcelink.json b/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.sourcelink.json index 5c6ea4f..c0b3c60 100644 --- a/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.sourcelink.json +++ b/Csharp/Gokspel/obj/Debug/net9.0-windows/Gokspel.sourcelink.json @@ -1 +1 @@ -{"documents":{"C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\*":"https://raw.githubusercontent.com/Alvin-Zilverstand/ict-algemeen-opdrachten/5e0e0a7907fee55389f89acc2c73bf9b341ddcaa/*"}} \ No newline at end of file +{"documents":{"C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\*":"https://raw.githubusercontent.com/Alvin-Zilverstand/ict-algemeen-opdrachten/a612e37e825def883bfd7fe26fc57829939c8f7c/*"}} \ No newline at end of file diff --git a/Csharp/Gokspel/obj/Debug/net9.0-windows/apphost.exe b/Csharp/Gokspel/obj/Debug/net9.0-windows/apphost.exe index 9ffac71..e2c1a1f 100644 Binary files a/Csharp/Gokspel/obj/Debug/net9.0-windows/apphost.exe and b/Csharp/Gokspel/obj/Debug/net9.0-windows/apphost.exe differ diff --git a/Csharp/Gokspel/obj/Debug/net9.0-windows/ref/Gokspel.dll b/Csharp/Gokspel/obj/Debug/net9.0-windows/ref/Gokspel.dll index cd00e65..9ad88cf 100644 Binary files a/Csharp/Gokspel/obj/Debug/net9.0-windows/ref/Gokspel.dll and b/Csharp/Gokspel/obj/Debug/net9.0-windows/ref/Gokspel.dll differ diff --git a/Csharp/Gokspel/obj/Debug/net9.0-windows/refint/Gokspel.dll b/Csharp/Gokspel/obj/Debug/net9.0-windows/refint/Gokspel.dll index cd00e65..9ad88cf 100644 Binary files a/Csharp/Gokspel/obj/Debug/net9.0-windows/refint/Gokspel.dll and b/Csharp/Gokspel/obj/Debug/net9.0-windows/refint/Gokspel.dll differ