using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Clicker_Game { public partial class Form1 : Form { private int clicker_counter = 0; private TimeSpan user_time; private DateTime alternate_user_time; public Form1() { InitializeComponent(); label1.Visible = false; label2.Visible = false; panel1.Visible = false; panel1.BackColor = System.Drawing.Color.DarkBlue; radioButton1.Checked = true; } private void button1_Click(object sender, EventArgs e) { String new_resulution = Form2.ShowBox("How hard should it be?","Choose difficulty"); if (new_resulution == "3") { panel1.Size = new Size(10,10); } if (new_resulution == "2") { panel1.Size = new Size(30, 30); } if (new_resulution == "1") { panel1.Size = new Size(50, 50); } label1.Visible = true; label2.Visible = true; panel1.Visible = true; radioButton1.Visible = false; radioButton2.Visible = false; button1.Visible = false; alternate_user_time = DateTime.Now; timer1.Start(); } private void panel1_MouseClick(object sender, MouseEventArgs e) { Random Rand_X = new Random(); int X_Random = Rand_X.Next(0, (this.Width - 50)); Random Rand_Y = new Random(); int Y_Random = Rand_Y.Next(0, (this.Height - 50)); panel1.Location = new Point(X_Random, Y_Random); clicker_counter++; label1.Text = "Points: " + clicker_counter; } private void radioButton1_CheckedChanged(object sender, EventArgs e) { } private void timer1_Tick(object sender, EventArgs e) { user_time = DateTime.Now - alternate_user_time; label2.Text = "Time: " + new DateTime(user_time.Ticks).ToString("ss.f"); if (radioButton1.Checked == true) { if (clicker_counter >= 10) { timer1.Stop(); DialogResult Resulution = MessageBox.Show("Congratulations! You did it with " + new DateTime(user_time.Ticks).ToString("ss.f") + " seconds and " + clicker_counter + " Hits! LOOSER!" + Environment.NewLine + "Wanna play again?", "Importance[Shouting at you]", MessageBoxButtons.YesNo); if (Resulution == DialogResult.Yes) { clicker_counter = 0; label1.Text = "Points: " + clicker_counter; label1.Visible = false; label2.Visible = false; panel1.Visible = false; radioButton1.Visible = true; radioButton2.Visible = true; button1.Visible = true; } else { MessageBox.Show("Have a nice day! Not!"); this.Close(); } } } if (radioButton2.Checked == true) { if (new DateTime(user_time.Ticks).ToString("ss") == "10") { timer1.Stop(); DialogResult Resulution = MessageBox.Show("Congratulations! You did it with " + new DateTime(user_time.Ticks).ToString("ss") + " seconds and " + clicker_counter + " Hits! LOOSER!" + Environment.NewLine + "Wanna play again?", "Importance[Shouting at you]", MessageBoxButtons.YesNo); if (Resulution == DialogResult.Yes) { clicker_counter = 0; label1.Text = "Points: " + clicker_counter; label1.Visible = false; label2.Visible = false; panel1.Visible = false; radioButton1.Visible = true; radioButton2.Visible = true; button1.Visible = true; } else { MessageBox.Show("Have a nice day! Not!"); this.Close(); } } } } } }