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 Window_KeyDown(object sender, KeyEventArgs e) { if (can.Visibility == Visibility.Visible) { switch (e.Key) { case Key.Left: stMovLeft = true; break; case Key.Right: stMovRight = true; break; case Key.Space: if (onFloor == true) { stjump = true; onFloor = false; BitmapImage bity = new BitmapImage(new Uri("pack://application:,,,/Jump.png")); sprite.Source = bity; } break; case Key.Q: HighScore(); MainWindow mW = new MainWindow(); mW.Show(); Close(); break; case Key.S: SecondWindow mw = new SecondWindow(); mw.Show(); this.Close(); DeathCounter x = new DeathCounter(); break; } } }