private void Form1_MouseClick(object sender, MouseEventArgs e) { if (e.X > 850 && e.X < 945 && e.Y > 0 && e.Y < 32) { Timegameloop.Start(); timer1.Enabled = true; miss--; } if (e.X > 850 && e.X < 945 && e.Y > 39 && e.Y < 69) { Timegameloop.Stop(); } if (e.X > 850 && e.X < 945 && e.Y > 77 && e.Y < 103) { Timegameloop.Stop(); } if (e.X > 850 && e.X < 945 && e.Y > 114 && e.Y < 135) { this.Close(); } if (Cdiablos.Hit(e.X, e.Y)) { splat = true; CSplat.left = Cdiablos.left + 90; CSplat.top = Cdiablos.top + 40; hits++; } else { miss++; } points = hits - miss; totalshot = hits + miss; }
private void timer1_Tick(object sender, EventArgs e) { Timegameloop.Stop(); if (points >= 10) { MessageBox.Show("You WON!"); this.Close(); } else { MessageBox.Show("You LOST!"); this.Close(); } }
private void Form1_Load(object sender, EventArgs e) { Timegameloop.Stop(); // Define the border style of the form to a dialog box. this.FormBorderStyle = FormBorderStyle.FixedDialog; // Set the MaximizeBox to false to remove the maximize box. this.MaximizeBox = false; // Set the MinimizeBox to false to remove the minimize box. this.MinimizeBox = false; // Set the start position of the form to the center of the screen. this.StartPosition = FormStartPosition.CenterScreen; }