private void button1_Click(object sender, EventArgs e) { if (win != null) { win.Close(); } win = new newGame(); win.Show(); }
private void mainthread_Tick(object sender, EventArgs e) { tCounter += 1; tLabel.Left = button1.Left + button1.Width + 5; Mode.Left = tLabel.Left + tLabel.Width + 5; this.Height = Game[0, gridSize.Y - 1].vis.Top + 3 * cubeSize - 5; this.Width = Game[gridSize.X - 1, 0].vis.Left + 2 * cubeSize - 5; ShowBombs.Left = this.Width - ShowBombs.Width - 20; background.Width = this.Width; if (tCounter % 100 == 0 && !lose) { timer.inc(); } tLabel.Text = timer.time(); if (WinGame() && !lose) { lose = true; MessageBox.Show("Good Job, your time was: " + timer.time()); } if (win != null) { if (win.finished) { lose = false; initGame(win.intwidth, win.intheight, win.intbombs); win.Close(); win = null; } } }