Exemplo n.º 1
0
        //-------------------------------------------------------
        static public void StartGame
            (ref Grid grid, ref Platform platform, ref List <Ball> balls, ref List <Brick> bricks, ref List <Bonus> bonuses)
        {
            _gameOver = false;
            _score    = 0;
            _life     = 3;
            _level    = 1;

            Uri pathToBackground         = new Uri("./Graphics/background-0.png", UriKind.Relative);
            TransformingImage background = new TransformingImage(pathToBackground, grid, 160, 0, 480, 600);

            _labelScore        = new Label();
            _labelScore.Margin = new Thickness(8, 16, 0, 0);
            grid.Children.Add(_labelScore);

            _labelLife        = new Label();
            _labelLife.Margin = new Thickness(8, 32, 0, 0);
            grid.Children.Add(_labelLife);

            _labelLevel        = new Label();
            _labelLevel.Margin = new Thickness(8, 48, 0, 0);
            grid.Children.Add(_labelLevel);

            RefreshStatistics(ref grid);
            StartLevel(ref grid, ref platform, ref balls, ref bricks, ref bonuses);
        }
Exemplo n.º 2
0
        //-------------------------------------------------------
        public Platform(Grid grid)
        {
            _platformLeft   = new TransformingImage(new Uri("./Graphics/platform_left.png", UriKind.Relative), grid, 268, 552);
            _platformMiddle = new TransformingImage(new Uri("./Graphics/platform_middle.png", UriKind.Relative), grid, 300, 552, 0);
            _platformRight  = new TransformingImage(new Uri("./Graphics/platform_right.png", UriKind.Relative), grid, 301, 552);

            _speed      = 3;
            _sizeDegree = 3;
            RefreshSize(grid.Width / 2);
        }
        private void CreateWalls()
        {
            //Physical part
            walls = new List <Rect>();

            Rect leftWall  = new Rect(0, 0, 160, 600);
            Rect rightWall = new Rect(640, 0, 160, 600);
            Rect ceiling   = new Rect(0, -4, 800, 4);

            walls.Add(leftWall);
            walls.Add(rightWall);
            walls.Add(ceiling);

            //Graphics layout
            TransformingImage leftWallImg = new TransformingImage
                                                (new Uri("./Graphics/background_wall.png", UriKind.Relative), gameGrid, 0, 0, 160, 600);
            TransformingImage rightWallImg = new TransformingImage
                                                 (new Uri("./Graphics/background_wall.png", UriKind.Relative), gameGrid, 640, 0, 160, 600);
        }