Example #1
0
        private void btnPlay_Click(object sender, RoutedEventArgs e)
        {
            Splash splash = new Splash();

            splash.Show();
            Level1 gameWindow = new Level1();

            MainWindow main = new MainWindow();

            for (int i = 0; i < 100; i++)
            {
                Thread.Sleep(i);
            }

            gameWindow.Show();
            new Level1();
            for (int i = 0; i < 5; i++)
            {
                Thread.Sleep(i);
            }

            splash.Close();


            this.Close();
        }
Example #2
0
        // Keydown functions
        public void Window_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            //TODO remove or something this
            //this was just for laughs, to test if we can rotate the whole canvas with Q
            case Key.Q:
                RotateTest     += 45;
                cnvRotate.Angle = RotateTest;
                break;

            case Key.Space:

                IsGrounded = true;

                if (Config.Paused == true)
                {
                    this.Cursor         = Cursors.None;
                    Config.Paused       = false;
                    cnvPause.Visibility = Visibility.Hidden;
                    timer.Start();
                }

                break;

            case Key.Escape:

                if (Config.Paused == false)
                {
                    this.Cursor = Cursors.Arrow;
                    mdePause.Play();
                    cnvPause.Visibility = Visibility.Visible;
                    Config.Paused       = true;
                    timer.Stop();
                }
                else
                {
                    Config.Paused = false;
                }
                break;

            case Key.R:

                if (Config.Paused == true)
                {
                    Level1 retry = new Level1();
                    retry.Show();
                    this.Close();
                    cnvPause.Visibility = Visibility.Hidden;
                    mdePause.Stop();
                    Config.Paused = false;
                    timer.Start();
                }
                break;
            }
        }
Example #3
0
        //retry button
        public void Button_Click(object sender, RoutedEventArgs e)
        {
            // restart rctTargetng
            if (frmLevel.Content == null)
            {
                Level1 retry = new Level1();
                frmLevel.Content = null;
                retry.Show();
                Close();
            }
            else
            {//resets the current level
                switch (Config.txtLevel)
                {
                case 1:
                    frmLevel.Content = new Level2();
                    break;

                case 2:
                    frmLevel.Content = new Level3();
                    break;

                case 3:
                    frmLevel.Content = new Level4();
                    break;

                case 4:
                    frmLevel.Content = new Level5();
                    break;

                default:
                    break;
                }
            }

            cnvPause.Visibility = Visibility.Hidden;
            mdePause.Stop();
            Config.Paused = false;
            timer.Start();
        }