private void update() { if (x.KeyDetection(can, ref sprite)) { timer.IsEnabled = false; MessageBox.Show("Congratulations you have completed the level... Prepare to die in next one!!!!!"); Success x = new Success(username); SecondWindow mW = new SecondWindow(); Close(); mW.Show(); //#lol } else if (x.BombDetection(can, ref sprite)) { timer.IsEnabled = false; MessageBox.Show("You died... TO A BOMB"); DeathCounter x = new DeathCounter(); SecondWindow mW = new SecondWindow(); mW.Show(); Close(); } else if (EnemyDetect()) { timer.IsEnabled = false; MessageBox.Show("You died... TO AN ALIEN"); DeathCounter x = new DeathCounter(); SecondWindow mW = new SecondWindow(); mW.Show(); Close(); } }
private void btnStart_Click(Object sender, RoutedEventArgs e) { if (!txtUsername.Text.Equals("")) { Username = txtUsername.Text; StreamWriter deathsFile = new StreamWriter(/*"C:\\Deaths.txt"*/ "Deaths.txt"); deathsFile.WriteLine(Username); deathsFile.WriteLine("0"); deathsFile.Close(); StreamWriter passFile = new StreamWriter(/*"J:\\Passed.txt"*/ "Passed.txt"); passFile.WriteLine("0"); passFile.Close(); SecondWindow mW = new SecondWindow(); mW.Show(); mW.retUser(/*Username*/ "james"); Close(); } }