Ejemplo n.º 1
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
                
                engine.AddObject(new UnpassableBlock(new MatrixCoords(3, i * 4)));
            }
            engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow + 1, 6)));
            engine.AddObject(new GiftBlock(new MatrixCoords(startRow + 1, endCol - 2)));

            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            //Ball theBall = new MeteoritBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            //Ball theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);
            engine.AddObject(theRacket);
        }
Ejemplo n.º 2
0
        /* Legend:
            G - gift block
            X - gift (the block that is dropped after G is hit)
            E - the exploding block
            * - TrailObject (used by the meteorite ball or after explosion of ExplodingBlock)
            @ - bullet fired by the racket
            % - ExplosionBlockResult blocks
         */
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            // build ceiling and left wall for the scene
            for (int i = 0; i < endCol; i++)
            {
                Block ceilingBlock = new IndestructibleBlock(new MatrixCoords(0, i));
                Block leftWallBlock = new IndestructibleBlock(new MatrixCoords(i, 0));

                engine.AddObject(ceilingBlock);
                engine.AddObject(leftWallBlock);
            }

            // build right wall for the scene
            for (int i = 0; i < WorldRows; i++)
            {
                Block rightWallBlock = new IndestructibleBlock(new MatrixCoords(i, endCol - 1));
                engine.AddObject(rightWallBlock);
            }

            // meteorite or unstoppable ball test
            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Racket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            // test trail object with random MatrixCoords and lifetime = 15 turns
            GameObject trailObj = new TrailObject(new MatrixCoords(WorldRows - 6, WorldCols - 12), 15);
            engine.AddObject(trailObj);

            // add a gift block
            Block giftBlock = new GiftBlock(new MatrixCoords(WorldRows - 11, WorldCols - 20));
            engine.AddObject(giftBlock);

            //add unpassable block with random coords
            Block unpassable = new UnpassableBlock(new MatrixCoords(WorldRows - 15, WorldCols - 10));
            engine.AddObject(unpassable);

            // add exploding block and ordinary blocks around it
            Block explodingBlock = new ExplodingBlock(new MatrixCoords(WorldRows - 12, WorldCols - 35));
            Block leftToExploding = new Block(explodingBlock.TopLeft + new MatrixCoords(0, -1));
            Block rightToExploding = new Block(explodingBlock.TopLeft + new MatrixCoords(0, 1));
            engine.AddObject(explodingBlock);
            engine.AddObject(leftToExploding);
            engine.AddObject(rightToExploding);
        }
Ejemplo n.º 3
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            //Ball ball = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));

            //engine.AddObject(ball);
            //ex 6
            MeteoriteBall mball = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(mball);
            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(row, 0));
                engine.AddObject(leftWall);
                IndestructibleBlock rigthWall = new IndestructibleBlock(new MatrixCoords(row, WorldCols-1));
                engine.AddObject(rigthWall);
            }
            //ex 5
            //TrailObject lifeObj = new TrailObject(new MatrixCoords(4, 10), new char[,] { { '#' } }, 8);
            //engine.AddObject(lifeObj);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;
            Random rnd = new Random();

            for (int i = startCol; i < endCol; i++)
            {

                if (rnd.Next(startCol, WorldCols*2)> endCol)
                {
                    Block currBlock = new Block(new MatrixCoords(startRow, i));
                    engine.AddObject(currBlock);
                }
                else if (rnd.Next(startCol, WorldCols * 3) > endCol)
                {
                    ExplodingBlock boomBlock = new ExplodingBlock(new MatrixCoords(startRow, i));

                    engine.AddObject(boomBlock);
                }
                else if (rnd.Next(startCol, WorldCols * 4) > endCol)
                {
                    GiftBlock giftBlock = new GiftBlock(new MatrixCoords(startRow, i));

                    engine.AddObject(giftBlock);
                }
                else
                {
                    UnpassableBlock unpBlock = new UnpassableBlock(new MatrixCoords(startRow, i));
                    engine.AddObject(unpBlock);
                }

            }

            MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
            Racket newtheRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength + 1);
            engine.AddObject(newtheRacket);
            // Add side wallsя
            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock leftWallBlock = new IndestructibleBlock(new MatrixCoords(row, 0));
                engine.AddObject(leftWallBlock);
                IndestructibleBlock rightWallBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));
                engine.AddObject(rightWallBlock);
            }
            for (int col = 0; col < WorldCols; col++)
            {
                IndestructibleBlock roof = new IndestructibleBlock(new MatrixCoords(0, col));
                engine.AddObject(roof);
            }
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int col = startCol; col < endCol; col++)
            {
                if (col == (WorldCols - 2) / 4 || col == WorldCols / 2 ||
                    col == WorldCols - 10 || col == WorldCols - 5) // Task 12: Testing the classes Gift and GiftBlock
                {
                    engine.AddObject(new GiftBlock(new MatrixCoords(startRow, col)));
                    continue;
                }
                Block currBlock = new Block(new MatrixCoords(startRow, col));
                engine.AddObject(currBlock);
            }

            // Task 1: Creating the side walls
            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock leftSideWallBlock = new IndestructibleBlock(new MatrixCoords(row, 0));
                engine.AddObject(leftSideWallBlock);
                IndestructibleBlock rightSideWallBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));
                engine.AddObject(rightSideWallBlock);
            }

            // Task 1: Creating the ceiling wall
            for (int col = 1; col < WorldCols - 1; col++)
            {
                IndestructibleBlock ceilingWallBlock = new IndestructibleBlock(new MatrixCoords(0, col));
                engine.AddObject(ceilingWallBlock);
            }

            // Task 10: Testing the ExplodingBlock class
            //engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow + 3, startCol + 4)));
            //engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow + 3, startCol + 3)));
            //engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow + 3, startCol + 5)));
            //engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow + 3, startCol + 7)));

            // Task 7: Replacing the normal ball with meteorite ball
            MeteoriteBall metoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(metoriteBall);

            //// Task 9: Testing the UnstoppableBall class
            //UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            //engine.AddObject(unstoppableBall);

            // Task 9: Testing the UnpassableBlock class
            for (int col = 5; col < WorldCols; col += 15)
            {
                engine.AddObject(new UnpassableBlock(new MatrixCoords(5, col)));
            }

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block secondBlock = new Block(new MatrixCoords(startRow + 1, i));
                engine.AddObject(secondBlock);
            }

            for (int i = 3; i < 10; i++)
            {
                UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(startRow + 3, i * 3));
                engine.AddObject(currBlock);
            }

            engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow + 3, endCol - 1)));
            engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow + 3, endCol - 5)));
            engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow, endCol - 4)));
            engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow, endCol - 9)));
            engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow, 12)));
            engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow, 17)));
            engine.AddObject(new GiftBlock(new MatrixCoords(startRow, 5)));
            engine.AddObject(new GiftBlock(new MatrixCoords(startRow, 10)));
            engine.AddObject(new GiftBlock(new MatrixCoords(startRow, 15)));

            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));

            //engine.AddObject(theBall);

            MeteoriteBall metBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(metBall);

            UnstoppableBall unstopBall = new UnstoppableBall(new MatrixCoords(22, 10), new MatrixCoords(-1, 1));
            engine.AddObject(unstopBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            for (int i = 0; i < WorldRows; i++)
            {
                engine.AddObject(new IndestructibleBlock(new MatrixCoords(i, 0)));
                engine.AddObject(new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1)));
            }
            for (int i = 0; i < WorldCols; i++)
            {
                engine.AddObject(new IndestructibleBlock(new MatrixCoords(0, i)));
            }
            for (int i = 0; i < WorldCols; i++)
            {
                engine.AddObject(new GameOverBlock(new MatrixCoords(WorldRows, i)));
            }
            engine.AddTrailingObject(new TrailObject(new MatrixCoords(15, 20), new char[,] { { 'S', 't', 'a', 'r', 't' }, { 'G', 'a', 'm', 'e', ' ' } }, 10));
        }
Ejemplo n.º 7
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;
            for (int col = 0; col <WorldCols; col++)
            {
                IndestructibleBlock wallLeftBlock = new IndestructibleBlock(new MatrixCoords(0,col));
                engine.AddObject(wallLeftBlock);
            }
            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));
                if (i == 7) //the seventh block is the first block, being hit by the ball
                {
                    currBlock = new ExplodingBlock(new MatrixCoords(startRow, i));
                }
                else if (i == endCol-3) //you'll have to wait a little bit to see hit that block with the gift
                {
                    currBlock = new GiftBlock(new MatrixCoords(startRow, i));
                }
                engine.AddObject(currBlock);

            }
            //Add side walls
            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock wallLeftBlock = new IndestructibleBlock(new MatrixCoords(row, 0));
                engine.AddObject(wallLeftBlock);
                IndestructibleBlock wallRightBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));
                engine.AddObject(wallRightBlock);
            }
            //trail object
            char[,] signOfTrail={{'*'}};
            TrailObject trail=new TrailObject(new MatrixCoords(13,13),signOfTrail,10);
            engine.AddObject(trail);

            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            //testing the meteorite ball
            MeteoriteBall secondBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));

            engine.AddObject(secondBall);
            //engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

               // adding an unpassable block and an unstoppable ball
            for (int i = 10; i < WorldRows; i++)
            {
                engine.AddObject(new UnpassableBlock(new MatrixCoords(i, 8)));
            }

            engine.AddObject(new UnstoppableBall(new MatrixCoords(WorldRows - 1, WorldCols / 2 + 1), new MatrixCoords(-1, 1)));
        }
Ejemplo n.º 8
0
        static void Initialize(Engine engine)
        {
            int startRow = 2;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow+1, i));

                engine.AddObject(currBlock);
            }
            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow + 2, i));

                engine.AddObject(currBlock);
            }

            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 35),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Ball twoBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
               new MatrixCoords(-1, 1));

            engine.AddObject(twoBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 2, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock wallLeft = new IndestructibleBlock(new MatrixCoords(row,0));
                engine.AddObject(wallLeft);
                IndestructibleBlock wallRight = new IndestructibleBlock(new MatrixCoords(row, WorldCols-1));
                engine.AddObject(wallRight);

            }
            for (int col = 0; col < WorldCols; col++)
            {
                IndestructibleBlock wallDown = new IndestructibleBlock(new MatrixCoords(WorldRows - 1, col));
                engine.AddObject(wallDown);
                IndestructibleBlock wallUp = new IndestructibleBlock(new MatrixCoords(startRow-2, col));
                engine.AddObject(wallUp);
            }
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                if (i == 3)
                {
                    ExplodingBlock expBlock = new ExplodingBlock(new MatrixCoords(startRow, i));
                    engine.AddObject(expBlock);
                    continue;
                }
                if (i == 2)
                {
                    GiftBlock giftblock = new GiftBlock(new MatrixCoords(startRow, i));
                    engine.AddObject(giftblock);
                    continue;
                }
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

               // Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
               //     new MatrixCoords(-1, 1));
            //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            for (int i = startRow; i < Console.BufferHeight; i++)
            {
                engine.AddObject(new UnpassableBlock(new MatrixCoords(i, startCol - 1)));
            }
            for (int i = startRow; i < Console.BufferHeight; i++)
            {
                engine.AddObject(new UnpassableBlock(new MatrixCoords(i, WorldCols - 2)));
            }
            for (int i = startCol-1; i < WorldCols-1; i++)
            {
                engine.AddObject(new UnpassableBlock(new MatrixCoords(startRow - 1, i)));
            }
            Random rnd = new Random();
            for (int i = 0; i < 5; i++)
            {
                engine.AddObject(new UnpassableBlock(new MatrixCoords((rnd.Next(0, WorldCols)), (rnd.Next(0, WorldRows)))));
            }
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            // Add walls
            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock currLeftWall = 
                    new IndestructibleBlock(new MatrixCoords(i, 0));

                engine.AddObject(currLeftWall);

                IndestructibleBlock currRightWall =
                    new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));

                engine.AddObject(currRightWall);
            }
            
            //add roof
            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock currLeftWall =
                    new IndestructibleBlock(new MatrixCoords(0, i), '-');

                engine.AddObject(currLeftWall);
            }

            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));
            engine.AddObject(theBall);

            //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));

            //Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            //engine.AddObject(theUnstopableBall);

            
            //engine.AddObject(new UnpassableBlocks(new MatrixCoords(3, 6)));
            

            engine.AddObject(new GiftBlock(new MatrixCoords(4, 6)));

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }
Ejemplo n.º 11
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));
                //if (i == 7)//Task 10 -> the first block that the ball hits is exploadable
                //{
                //    currBlock = new ExplodingBlock(new MatrixCoords(startRow, i));
                //}
                //Task 12 - bellow
                //if (i == endCol - 3) //the second block that the ball hits
                //{
                //    currBlock = new GiftBlock(new MatrixCoords(startRow, i));
                //}
                engine.AddObject(currBlock);
            }
            // Add walls - Task 1
            for (int row = 2; row < WorldRows; row++)
            {
                IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(row, 0));
                IndestructibleBlock rightWall = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));
                engine.AddObject(leftWall);
                engine.AddObject(rightWall);
            }
            for (int col = 0; col < WorldCols; col++)
            {
                IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(2, col));
                engine.AddObject(topWall);
            }
            // Task 9 - the UnpassableBlock, indestructible block
            //for (int i = 2; i < WorldCols / 2; i += 4)
            //{
            //    engine.AddObject(new UnpassableBlock(new MatrixCoords(4, i)));
            //}
            //Task 7 --> Test the MeteoriteBall by replacing the normal ball in the AcademyPopcornMain.cs file.
            //Ball meteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            //engine.AddObject(meteoriteBall);

            //Task 9 - > the ball destroys all, but bounces off UnpassableBlocks and the wall (so that we can keep playing :) )
            Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(theUnstopableBall);

            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            //engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }
Ejemplo n.º 12
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i), new [,] {{'#'}});

                engine.AddObject(currBlock);
            }
            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow + 1, i), new[,] { { '#' } });

                engine.AddObject(currBlock);
            }
            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow + 2, i), new[,] { { '#' } });

                engine.AddObject(currBlock);
            }

            Racket someRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);
            engine.AddObject(someRacket);

            for (int row = 3; row < WorldRows; row++)
            {
                UnpassableBlock leftWall = new UnpassableBlock(new MatrixCoords(row, 1));
                engine.AddObject(leftWall);
                UnpassableBlock rightWall = new UnpassableBlock(new MatrixCoords(row, endCol));
                engine.AddObject(rightWall);
            }
            for (int col = 1; col <= endCol; col++)
            {
                IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(startRow - 1, col));
                engine.AddObject(topWall);
            }

            //MeteoriteBall meteoriteBall = new MeteoriteBall(new MatrixCoords(7, 7), new MatrixCoords(1, 1));
            //engine.AddObject(meteoriteBall);

            UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(7, 7), new MatrixCoords(1, 1));
            engine.AddObject(unstoppableBall);

            ExplodingBlock explodingBlock = new ExplodingBlock(new MatrixCoords(startRow + 3, 15));
            engine.AddObject(explodingBlock);

            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(startRow + 3, endCol - 1));
            engine.AddObject(giftBlock);
        }
Ejemplo n.º 13
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            // The normal ball without trail
            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));

            //engine.AddObject(theBall);

            // Exercise 7: Test the MeteoriteBall by replacing the normal ball in the AcademyPopcornMain.cs file.
            MeteoriteBall theMeteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(theMeteoriteBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            // Exercise 1 - Add left and right side walls
            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock leftWallBlock = new IndestructibleBlock(new MatrixCoords(row, 1));

                engine.AddObject(leftWallBlock);
                IndestructibleBlock rightWallBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));

                engine.AddObject(rightWallBlock);
            }

            // Exercise 1 - Add ceiling wall
            for (int col = 1; col < WorldCols; col++)
            {
                IndestructibleBlock upperWallBlock = new IndestructibleBlock(new MatrixCoords(1, col));

                engine.AddObject(upperWallBlock);
            }
            // Exercise 5 - test the trailObject by adding an instance of TrailObject in the engine
            // it appears in the middle of the game screen and disappears after a certain period of time
            TrailObject trailObject = new TrailObject(new MatrixCoords((WorldRows / 2), (WorldCols / 2)), new char[,] { { '*' } }, 10);
            engine.AddObject(trailObject);
        }
Ejemplo n.º 14
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            for (int i = startCol; i < endCol; i++)
            {
                UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(startRow - 2, i));

                engine.AddObject(currBlock);
            }

            for (int i = startCol; i < endCol; i+=2)
            {
                ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow + 1, i));

                engine.AddObject(currBlock);
            }
            for (int i = startCol; i < endCol; i += 2)
            {
                GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow + 2, i));

                engine.AddObject(currBlock);
            }
            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));
            UnstoppableBall unstoppable = new UnstoppableBall(new MatrixCoords(WorldRows / 2+4, 0),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);
            engine.AddObject(unstoppable);

            ShoothingRacket theRacket = new ShoothingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            //TrailObject test = new TrailObject(3, new MatrixCoords(5, 5), new char[1, 1]{{'H'}});
            //engine.AddObject(test);

            //walls
            InitializeWalls(engine);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            // Task 1
            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(i, 0));
                engine.AddObject(leftWall);
                IndestructibleBlock rightWall = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));
                engine.AddObject(rightWall);
            }

            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock ceiling = new IndestructibleBlock(new MatrixCoords(0, i));
                engine.AddObject(ceiling);
            }

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            // Task 5, 6, 7
            MeteoriteBall meteor = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(meteor);

            // Task 8, 9
            UnstoppableBall unstoppable = new UnstoppableBall(new MatrixCoords(4,4), new MatrixCoords(1, 1));
            engine.AddObject(unstoppable);
            UnpassableBlock unpassable = new UnpassableBlock(new MatrixCoords(9, 9));
            engine.AddObject(unpassable);
            // Task 10
            ExplodingBlock explodeBlock = new ExplodingBlock( new MatrixCoords(8,8));
            engine.AddObject(explodeBlock);

            // Task 11, 12
            GiftBlock gift = new GiftBlock(new MatrixCoords(10, 10));
            engine.AddObject(gift);
        }
Ejemplo n.º 16
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));
                // <Task 1>

                IndestructibleBlock ceilingBlock = new IndestructibleBlock(new MatrixCoords(startRow - 1, i));
                IndestructibleBlock leftSideBlock = new IndestructibleBlock(new MatrixCoords(i, startCol - 1));
                IndestructibleBlock rightSideBlock = new IndestructibleBlock(new MatrixCoords(i, endCol));

                engine.AddObject(ceilingBlock);
                engine.AddObject(leftSideBlock);
                engine.AddObject(rightSideBlock);
                engine.AddObject(currBlock);

            }
            //<Task 5>
            TrailObject trailBlock = new TrailObject(new MatrixCoords(WorldRows / 2, WorldCols / 2), new char[,] { { '&' } }, 30);

            engine.AddObject(trailBlock);

            /* <Task 6>
            MeteoriteBall mBall = new MeteoriteBall(new MatrixCoords(10, 10), new MatrixCoords(1, 1), 3);
            engine.AddObject(mBall);

            <Task9> Test UnstoppableBall
            Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(theUnstopableBall);

            for (int i = 2; i < WorldCols/2; i+=4)
            {
                engine.AddObject(new UnpassableBlock(new MatrixCoords(4, i)));
            }
             */

            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            engine.AddObject(new TailObject(new MatrixCoords(10, 5), new char[1,1] {{'%'}}, 5));

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock2 = new Block(new MatrixCoords(startRow + 1, i));
                engine.AddObject(currBlock2);
                ExplodingBlock currBlock3 = new ExplodingBlock(new MatrixCoords(startRow + 2, i));
                engine.AddObject(currBlock3);
                GiftBlock currBlock4 = new GiftBlock(new MatrixCoords(startRow + 3, i));
                engine.AddObject(currBlock4);

            }

            for (int i = startCol - 1; i <= endCol; i++)
            {
                IndestructibleBlock currBlock = new IndestructibleBlock(new MatrixCoords(startRow, i));
                engine.AddObject(currBlock);
            }

            for (int i = startRow; i <= WorldRows; i++)
            {
                IndestructibleBlock currBlock1 = new IndestructibleBlock(new MatrixCoords(i, startCol - 1));
                IndestructibleBlock currBlock2 = new IndestructibleBlock(new MatrixCoords(i, endCol      ));
                engine.AddObject(currBlock1);
                engine.AddObject(currBlock2);
            }

            //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));


            engine.AddObject(theBall);

            Gift gift = new Gift(new MatrixCoords(8, 20));
            engine.AddObject(gift);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));
                
                // task 10
                if (i == 7)
                {
                    currBlock = new ExplodingBlock(new MatrixCoords(startRow, i));
                }

                //task 12
                else if (i == endCol - 3)
                {
                    currBlock = new GiftBlock(new MatrixCoords(startRow, i));
                }

                engine.AddObject(currBlock);
            }

            /* 07. Test the MeteoriteBall by replacing the normal ball in the AcademyPopcornMain.cs file.*/
            /* Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));
            */
            Ball theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2 + 1, 0), new MatrixCoords(-1, 1));
            engine.AddObject(theBall);

            // 09. Test the UnpassableBlock and the UnstoppableBall by adding them to the engine in AcademyPopcornMain.cs file
           /* Ball theUnstopableBall = new UnstopableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(theUnstopableBall);

            for (int i = 2; i < WorldCols / 2; i += 4)
            {
                engine.AddObject(new UnpassableBlocks(new MatrixCoords(4, i)));
            }
            */
            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

        }
Ejemplo n.º 19
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));
                ExplodingBlock expBlock = new ExplodingBlock(new MatrixCoords(startRow + 2,i));
                Block someMoreBlock = new Block(new MatrixCoords(startRow + 1, i));
                engine.AddObject(currBlock);
                engine.AddObject(expBlock);
                engine.AddObject(someMoreBlock);
            }

            MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1),3);

            engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            //add sides
            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock leftIndestructibleBlock = new IndestructibleBlock(new MatrixCoords(row,0));
                engine.AddObject(leftIndestructibleBlock);
                IndestructibleBlock rightIndestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols-1));
                engine.AddObject(rightIndestructibleBlock);
            }
            //add roof
            for (int col = 0; col < WorldCols; col++)
            {
                IndestructibleBlock topIndestructibleBlock = new IndestructibleBlock(new MatrixCoords(0,col));
                engine.AddObject(topIndestructibleBlock);
            }

            Gift gift = new Gift(new MatrixCoords(0,10));
            engine.AddObject(gift);

            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(7,33));
            engine.AddObject(giftBlock);
        }
Ejemplo n.º 20
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            // 1. adding ceiling and left/right walls
            for (int i = startRow - 1; i < WorldRows; i++)
            {
                UnpassableBlock newIndBlockLeft = new UnpassableBlock(new MatrixCoords(i, startCol - 1));
                UnpassableBlock newIndBlockRight = new UnpassableBlock(new MatrixCoords(i, endCol));
                engine.AddObject(newIndBlockRight);
                engine.AddObject(newIndBlockLeft);
            }
            for (int i = startCol - 1; i <= endCol; i++)
            {
                UnpassableBlock newTopBlock = new UnpassableBlock(new MatrixCoords(startRow - 2, i));
                engine.AddObject(newTopBlock);
            }


            for (int i = startCol; i < endCol / 2; i++)
            {
                Block currBlock = new ExplodingBlock(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }
            for (int i = endCol / 2; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            TrailObject trailer = new TrailObject(new MatrixCoords(WorldRows / 2, WorldCols / 2), new char[,] { { 'H', 'E', 'L', 'L', 'O' } }, 5);
            engine.AddObject(trailer);

            // the ball is here 
            Ball theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 3), new MatrixCoords(-1, 1));
            engine.AddObject(theBall);

            // the racket - moves with A/D and space shoots
            Racket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);
            engine.AddObject(theRacket);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            //Add left/right/ side walls
            for (int i = startRow - 1; i < WorldRows + 1; i++)
            {
                IndestructibleBlock leftUndestrBlock = new IndestructibleBlock(new MatrixCoords(i, startCol - 2));
                engine.AddObject(leftUndestrBlock);

                IndestructibleBlock rightUndestrBlock = new IndestructibleBlock(new MatrixCoords(i, endCol + 1));
                engine.AddObject(rightUndestrBlock);
            }

            //Add ceiling
            for (int i = startCol - 1; i < WorldCols; i++)
            {
                IndestructibleBlock topUndestrBlock = new IndestructibleBlock(new MatrixCoords(startRow - 1, i));
                engine.AddObject(topUndestrBlock);

            }

            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            //engine.AddObject(theBall);

            //Meteorite ball
            MeteoriteBall theMeteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));
            engine.AddObject(theMeteoriteBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }
Ejemplo n.º 22
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Racket someRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);
            engine.AddObject(someRacket);

            //ShootingRacket shootingRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            //engine.AddObject(shootingRacket);

            for (int row = 3; row < WorldRows; row++)
            {
                IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(row, 1));
                engine.AddObject(leftWall);
                IndestructibleBlock rightWall = new IndestructibleBlock(new MatrixCoords(row, endCol));
                engine.AddObject(rightWall);
            }
            for (int col = 1; col <= endCol; col++)
            {
                IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(startRow - 1, col));
                engine.AddObject(topWall);
            }
            //TrailObject trailObject = new TrailObject(new MatrixCoords(7, 7), new[,] { { '*' } }, 15);
            //engine.AddObject(trailObject);
            MeteoriteBall meteoriteBall = new MeteoriteBall(new MatrixCoords(7, 7), new MatrixCoords(1, 1));
            engine.AddObject(meteoriteBall);
        }
Ejemplo n.º 23
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            // Task 1
            for (int j = 1; j < WorldRows; j++)
            {
                IndestructibleBlock leftBlock = new IndestructibleBlock(new MatrixCoords(j, 0));
                IndestructibleBlock rightBlock = new IndestructibleBlock(new MatrixCoords(j, WorldCols - 1));
                engine.AddObject(leftBlock);
                engine.AddObject(rightBlock);
            }

            // Task 1
            for (int z = 0; z < WorldCols; z++)
            {
                IndestructibleBlock topBlock = new IndestructibleBlock(new MatrixCoords(1, z));
                engine.AddObject(topBlock);
            }

            UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            //TrailObject trail = new TrailObject(new MatrixCoords(10, 10), new char[,] { {'T'} }, 10);
            //engine.AddObject(trail);
        }
Ejemplo n.º 24
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            // Task 1:
            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock ceilBlock = new IndestructibleBlock(new MatrixCoords(0, i));
                engine.AddObject(ceilBlock);
            }

            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock leftBlock = new IndestructibleBlock(new MatrixCoords(i, 0));
                IndestructibleBlock rightBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));

                engine.AddObject(leftBlock);
                engine.AddObject(rightBlock);
            }
            //End of task 1.
            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            //Task 7:
            MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }
Ejemplo n.º 25
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }
            // Task7: TestMeteoriteBall
            MeteoriteBall someMeteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1),3);
            engine.AddObject(someMeteoriteBall);
            //================================================================================================================
            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));

            //engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
            // Task1: CreateWalls
            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(row, 0));
                engine.AddObject(leftWall);
                IndestructibleBlock rightWall=new IndestructibleBlock(new MatrixCoords(row,WorldCols-1));
                engine.AddObject(rightWall);
            }
            for(int col=0;col<WorldCols;col++)
            {
                IndestructibleBlock uperWall=new IndestructibleBlock(new MatrixCoords(0,col));
                engine.AddObject(uperWall);
            }
            //====================================================================================
        }
Ejemplo n.º 27
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;
            for (int i = startCol; i < endCol/2; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }
            for (int i = (endCol/2); i < endCol; i++) // making unpassable blocks
            {
                UnpassableBlock unpBlock = new UnpassableBlock(new MatrixCoords(startRow, i));
                engine.AddObject(unpBlock);
            }
            Ball theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2 + 1 , 0), new MatrixCoords(-1, 1));
            Ball unstBall = new UnstoppableBall(new MatrixCoords(10, WorldCols - 1), new MatrixCoords(-1, -1)); //creating unstoppable ball
            engine.AddObject(unstBall);
            engine.AddObject(theBall);
            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);
            engine.AddObject(theRacket);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                if (i == 7) // first hit is that brick
                {
                    currBlock = new ExplodeBlock(new MatrixCoords(startRow, i));
                }

                if (i == 17)  // adding gift object
                {
                    currBlock = new GiftBlock(new MatrixCoords(startRow, i));
                }

                engine.AddObject(currBlock);
            }

            // Adding Unpassable Blocks
            for (int i = 10; i < 15; i++)
            {
                UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(5, i));
                engine.AddObject(unpassableBlock);
            }

            // Adding Unstoppable Ball
            //UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            //engine.AddObject(unstoppableBall);

            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(theBall);

            //MeteoriteBall meteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));

            //engine.AddObject(meteoriteBall);
            //engine.AddObject(meteoriteBall.Tail);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(i, 0));
                engine.AddObject(leftWall);

                IndestructibleBlock rightWall = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));
                engine.AddObject(rightWall);
            }

            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock ceiling = new IndestructibleBlock(new MatrixCoords(0, i));
                engine.AddObject(ceiling);
            }
        }
Ejemplo n.º 29
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            //The AcademyPopcorn class contains an IndestructibleBlock class. Use it to create side and ceiling walls to the game. You can ONLY edit the AcademyPopcornMain.cs file
            IndestructibleBlock indestructibleBlock = null;
            for (int row = 0; row < WorldRows; row++)
            {
                for (int col = 0; col < WorldCols; col++)
                {
                    if (row == 0)
                    {
                        indestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, col));
                        engine.AddObject(indestructibleBlock);
                    }
                    else if (col == 0 || col == WorldCols - 1)
                    {
                        indestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, col));
                        engine.AddObject(indestructibleBlock);
                    }
                }
            }

            for (int i = startCol; i < endCol; i++)
            {
                switch (i % 5)
                {
                    case 0:
                        ExplodingBlock explodingBlock = new ExplodingBlock(new MatrixCoords(startRow, i));
                        engine.AddObject(explodingBlock);
                        break;
                    default:
                        switch (i % 3)
                        {
                            case 0:
                                GiftBlock giftBlock = new GiftBlock(new MatrixCoords(startRow, i));
                                engine.AddObject(giftBlock);
                                break;
                            default:
                                Block currBlock = new Block(new MatrixCoords(startRow, i));
                                engine.AddObject(currBlock);
                                break;
                        }
                        break;
                }

            }

            for (int i = 4; i < endCol; i+=3)
            {
                UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(8, i));

                engine.AddObject(currBlock);
            }

            TrailObject to = new TrailObject(new MatrixCoords(5, 6), 15);
            engine.AddObject(to);

            UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            ShootingRacket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }
Ejemplo n.º 30
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < 10; i++) // Task 9 Test
            {
                UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            for (int i = 10; i < 20; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            for (int i = 20; i < 30; i++) // Task 12 Test GiftBlock and Gift
            {
                GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            for (int i = 30; i < endCol; i++) // Task 10. Exploding Block test
            {
                ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            for (int i = 0; i < WorldRows; i++) // Task 1 Create walls
            {
                IndestructibleBlock leftWalls = new IndestructibleBlock(new MatrixCoords(i, 0));
                IndestructibleBlock rightWalls = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));

                engine.AddObject(leftWalls);
                engine.AddObject(rightWalls);
            }

            for (int i = 0; i < WorldCols; i++) // Task 1 Create ceiling
            {
                IndestructibleBlock ceiling = new IndestructibleBlock(new MatrixCoords(0, i));

                engine.AddObject(ceiling);
            }

            MeteoriteBall meteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // Task 7 Add Meteorite Ball
                new MatrixCoords(-1, 1));

            engine.AddObject(meteoriteBall);

            //UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), // Task 9 Test Unstoppable ball
            //    new MatrixCoords(-1, 1));

            //engine.AddObject(unstoppableBall);

            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));

            //engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }