public void GenerateInitial()
        {
            firstPause    = true;
            Canvas.Width  = ClientRectangle.Width;
            Canvas.Height = ClientRectangle.Height;
            ImageSprite background = new ImageSprite(Image.FromFile("background.png"), 0, 0);

            background.Width  = ClientRectangle.Width;
            background.Height = ClientRectangle.Height;
            Canvas.Children.Add(background);
            background        = new ImageSprite(Image.FromFile("background.png"), ClientRectangle.Width, 0);
            background.Width  = ClientRectangle.Width;
            background.Height = ClientRectangle.Height;
            Canvas.Children.Add(background);
            PhysicsSprite block;

            for (int i = 0; i <= 2 * ClientRectangle.Width / unitSize; i++)
            {
                block        = new PhysicsSprite(Image.FromFile("castlewall.jpg"), i * unitSize, ClientRectangle.Height - unitSize);
                block.Height = unitSize;
                block.Width  = unitSize;
                Canvas.Children.Add(block);
            }
            ninja = new Player(Image.FromFile("ninja.png"), 0, ClientRectangle.Height - 2 * unitSize, 88, 88);
            Animation move = new Animation();

            move.IList    = new int[] { 0, 1, 2, 3, 4 };
            move.JList    = new int[] { 0, 0, 0, 0, 0 };
            move.TimeList = new int[] { 1, 1, 1, 1, 1 };
            ninja.Animations.Add("move", move);
            Animation stand = new Animation();

            stand.IList    = new int[] { 0, 0, 0, 0, 0 };
            stand.JList    = new int[] { 0, 0, 0, 0, 0 };
            stand.TimeList = new int[] { 1, 1, 1, 1, 1 };
            ninja.Animations.Add("stand", stand);
            ninja.Width  = unitSize;
            ninja.Height = unitSize;
            Canvas.Children.Add(ninja);
            lose = new TextSprite("You've been caught!", ClientRectangle.Width / 2, ClientRectangle.Height / 2);
            Canvas.Children.Add(lose);
            lose.Visible = false;
        }
        public void Pause()
        {
            if (firstPause)
            {
                firstPause = false;
                mainMenu   = new ImageSprite(Image.FromFile("castlewall.jpg"), ClientRectangle.Width / 4, ClientRectangle.Height / 8);

                mainMenu.Width  = Width / 2;
                mainMenu.Height = Height / 4;
                Canvas.Children.Add(mainMenu);

                menuText = new TextSprite("Close", ClientRectangle.Width / 4, ClientRectangle.Height / 8);
                mainMenu.Children.Add(menuText);
            }
            if (paused)
            {
                next.Visible = false;
            }
            if (paused)
            {
                mainMenu.Visible = false;
            }
            if (paused)
            {
                lastSpeed = speed;
                speed     = 999999;
            }
            else
            {
                speed = lastSpeed;
            }
            paused = !paused;

            foreach (Sprite child in Canvas.Children)
            {
                if (child != lose)
                {
                    child.Visible = !child.Visible;
                }
            }
        }