/* 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);
        }
        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 i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

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

                engine.AddObject(currBlock);
            }

            for (int i = startCol + 12; i < endCol - 7; i += 3)
            {
                ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow + 3, i));

                engine.AddObject(currBlock);
            }

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

                engine.AddObject(currBlock);
            }

            UnstopableBall theBall = new UnstopableBall(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);

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

                indBlock = new IndestructibleBlock(new MatrixCoords(i, 0));
                engine.AddObject(indBlock);
            }

            for (int i = 1; i < WorldCols - 1; i++)
            {
                IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(0, i));
                engine.AddObject(indBlock);
            }
        }
        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 currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            // 01. Adding the ceiling
            // Adding the top wall
            startCol -= 2;
            startRow -= 2;
            for (int i = startCol; i < WorldCols; i++)
            {
                IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(startRow, i));
                engine.AddObject(topWall);
            }

            // Adding the left wall
            startRow = 2;
            startCol = 0;
            for (int i = startRow; i < WorldRows; i++)
            {
                IndestructibleBlock currWall = new IndestructibleBlock(new MatrixCoords(i, startCol));
                engine.AddObject(currWall);
            }

            // Adding the right wall
            startRow = 2;
            startCol = WorldCols - 1;
            for (int i = startRow; i < WorldRows; i++)
            {
                IndestructibleBlock currWall = new IndestructibleBlock(new MatrixCoords(i, startCol));
                engine.AddObject(currWall);
            }

            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);

            // 05. Initialize Trailing object
            // !!! The Object disapears instantly - Must find why!!!
            TrailObject simpleTrailObject = new TrailObject(new MatrixCoords(10, 10), new char[, ] {
                { '$' }
            }, 500);

            engine.AddObject(simpleTrailObject);
        }
Esempio 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)));
        }
Esempio 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 = 0; i < WorldCols; i++)
            {
                IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(0, i));

                engine.AddObject(indBlock);
            }

            for (int i = 1; i < WorldRows; i++)
            {
                IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(i, 0));

                engine.AddObject(indBlock);
            }

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

                engine.AddObject(indBlock);
            }

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

                engine.AddObject(currBlock);
            }

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

            engine.AddObject(theRacket);

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

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

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

            engine.AddObject(theUnsBall);

            UnpassableBlock theUnpasBlock = new UnpassableBlock(new MatrixCoords(WorldRows - 19, WorldCols - 21));

            engine.AddObject(theUnpasBlock);

            GiftBlock theGiftBlock = new GiftBlock(new MatrixCoords(5, 7));

            engine.AddObject(theGiftBlock);
        }
        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);
        }
Esempio n. 11
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++)
            {
                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);
        }
        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);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            //Problem One - Create ceiling wall
            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock ceilBlock = new IndestructibleBlock(new MatrixCoords(0, i));

                engine.AddObject(ceilBlock);
            }

            //Problem One - Create side walls
            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);
            }

            for (int i = startCol; i < endCol; i++)
            {
                //Problem Nine - Test UnpassableBlock
                //UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(startRow, i));

                //Problem Ten - Test ExplodingBlock
                //ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow, i));

                //Problem Twelve - Test GiftBlock
                GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

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

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

            engine.AddObject(theBall);

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

            engine.AddObject(theRacket);
        }
Esempio n. 15
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);
        }
Esempio 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));

                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);
        }
Esempio n. 17
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);
        }
Esempio n. 18
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;

            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);
        }
        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);
        }
Esempio n. 21
0
 private static void InitializeWalls(Engine engine)
 {
     for (int row = 0; row < WorldRows; row++)
     {
         IndestructibleBlock wall = new IndestructibleBlock(new MatrixCoords(row, 0));
         engine.AddObject(wall);
         wall = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));
         engine.AddObject(wall);
     }
     //ceiling
     for (int col = 1; col < WorldCols-1; col++)
     {
         IndestructibleBlock wall = new IndestructibleBlock(new MatrixCoords(0, col));
         engine.AddObject(wall);
     }
 }
        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);
        }
Esempio n. 23
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            //task one
            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);
            }
            //

            //nineth task
            //tenth task
            //twelfth task
            for (int i = startCol; i < endCol; i++)
            {
                GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

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

            engine.AddObject(theBall);

            //thirdteenth task
            ShootingRacket 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);
        }
Esempio 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 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);
        }
        private static void AddGameFieldWalls(Engine engine)
        {
            // add left and right wolls
            for (int row = 2; row < WorldRows; row++)
            {
                var leftWoll = new IndestructibleBlock(new MatrixCoords(row, 0));
                var rightWoll = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));

                engine.AddObject(leftWoll);
                engine.AddObject(rightWoll);
            }

            // add roof
            for (int col = 0; col < WorldCols; col++)
            {
                var roof = new IndestructibleBlock(new MatrixCoords(1, col));

                engine.AddObject(roof);
            }
        }
        private static void AddGameFieldWalls(Engine engine)
        {
            // add left and right wolls
            for (int row = 2; row < WorldRows; row++)
            {
                var leftWoll  = new IndestructibleBlock(new MatrixCoords(row, 0));
                var rightWoll = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));

                engine.AddObject(leftWoll);
                engine.AddObject(rightWoll);
            }

            // add roof
            for (int col = 0; col < WorldCols; col++)
            {
                var roof = new IndestructibleBlock(new MatrixCoords(1, col));

                engine.AddObject(roof);
            }
        }
Esempio n. 28
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);
        }
 static void SetBorders(Engine engine)
 {
     //left border
     for (int row = 0; row < WorldRows; row++)
     {
         IndestructibleBlock borderLeft = new IndestructibleBlock(new MatrixCoords(row, 0));
         engine.AddObject(borderLeft);
     }
     //right border
     for (int row = 0; row < WorldRows; row++)
     {
         IndestructibleBlock borderRight = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));
         engine.AddObject(borderRight);
     }
     //top
     for (int col = 0; col < WorldCols; col++)
     {
         IndestructibleBlock borderTop = new IndestructibleBlock(new MatrixCoords(0, col));
         engine.AddObject(borderTop);
     }
 }
        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);
            }
            //====================================================================================
        }
Esempio n. 31
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);
        }
Esempio n. 32
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);
        }
Esempio n. 33
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol   = WorldCols - 2;

            #region Add some layers of ordinary blocks and a layer of exploding block in the middle

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock1 = new Block(new MatrixCoords(startRow, i));
                Block currBlock2 = new Block(new MatrixCoords(startRow + 1, i));
                Block currBlock3 = new Block(new MatrixCoords(startRow + 2, i));

                engine.AddObject(currBlock1);
                engine.AddObject(currBlock2);
                engine.AddObject(currBlock3);
            }

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

                engine.AddObject(currBlock);
            }

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock1 = new Block(new MatrixCoords(startRow + 4, i));
                Block currBlock2 = new Block(new MatrixCoords(startRow + 5, i));
                Block currBlock3 = new Block(new MatrixCoords(startRow + 6, i));

                engine.AddObject(currBlock1);
                engine.AddObject(currBlock2);
                engine.AddObject(currBlock3);
            }

            #endregion

            #region Add a layer of gift objects

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

            //    engine.AddObject(currBlock);
            //}

            #endregion

            #region Create side walls and a ceiling

            // create side walls
            for (int i = 0; i < WorldRows; i++)
            {
                // create a block for the left wall
                IndestructibleBlock leftWallBlock = new IndestructibleBlock(new MatrixCoords(i, 0));
                // create a block for the right wall
                IndestructibleBlock rightWallBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));

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

            for (int i = 0; i < WorldCols; i++)
            {
                // create a block for the ceiling
                IndestructibleBlock ceilingBlock = new IndestructibleBlock(new MatrixCoords(0, i));

                engine.AddObject(ceilingBlock);
            }

            #endregion

            #region Add an impassable wall

            //for (int i = startRow + 1; i < WorldRows; i++)
            //{
            //    // create an impassable block
            //    ImpassableBlock impassableBlock = new ImpassableBlock(new MatrixCoords(i, 2 * WorldCols / 3 + 2));

            //    engine.AddObject(impassableBlock);
            //}

            #endregion

            #region Create an ordinary ball

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

            #endregion

            #region Replace the ordinary ball with a MeteoriteBall object

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

            #endregion

            #region Replace the ordinary ball with an UnstoppableBall object

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

            #endregion

            engine.AddObject(theBall);

            #region Add the racket

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

            engine.AddObject(theRacket);

            #endregion

            #region Add an instance of the TrailObject class

            //TrailObject ephemera = new TrailObject(
            //    new MatrixCoords(WorldRows / 3, WorldCols / 3), new char[,] { { '@' } }, 10);

            //engine.AddObject(ephemera);

            #endregion

            #region Add a single gift

            Gift gift = new Gift(new MatrixCoords(WorldRows / 3, WorldCols / 3), new char[, ] {
                { '@' }
            });

            engine.AddObject(gift);

            #endregion
        }
Esempio n. 34
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            //01.   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.
            for (int i = 0; i < WorldRows; i++)
            {
                Block LeftBorder = new IndestructibleBlock(new MatrixCoords(i, 0));
                Block RigthBorder = new IndestructibleBlock(new MatrixCoords(i, WorldCols-1));

                engine.AddObject(LeftBorder);
                engine.AddObject(RigthBorder);
            }

            for (int i = 0; i < WorldCols-1; i++)
            {
                Block UpBorder = new IndestructibleBlock(new MatrixCoords(0,i));

                engine.AddObject(UpBorder);
            }

            ////Task 02 - test sleeptime
            //engine.SleepTime = 100;

            ////Task 05 - test the TrailObject by adding an instance of it in the engine through the AcademyPopcornMain.cs file.
            //TrailObject trail = new TrailObject(new MatrixCoords(WorldRows / 2, WorldCols / 2), new char[,] { { '%' } }, 20);
            //engine.AddObject(trail);

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

            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 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
            //for (int i = 10; i < WorldCols - 10; i++)
            //{
            //    //create an unpassable block
            //    UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(10, i));
            //    engine.AddObject(unpassableBlock);
            //}

            //UnstoppableBall ultimateBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 10), new MatrixCoords(-1, 1));
            //engine.AddObject(ultimateBall);

            ////10.   Test ExplodingBlock
            //for (int i = startCol; i < endCol; i++)
            //{
            //    if (i % 2 == 0)
            //    {
            //        ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow + 1, i));
            //        engine.AddObject(currBlock);
            //    }
            //    else
            //    {
            //        Block currBlock = new Block(new MatrixCoords(startRow + 1, i));
            //        engine.AddObject(currBlock);
            //    }
            //}

            ////12.   Test the Gift and GiftBlock classes by adding them through the AcademyPopcornMain.cs file.
            //for (int i = startCol + 5; i < endCol - 5; i++)
            //{
            //    GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow + 10, i));
            //    engine.AddObject(currBlock);
            //}

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

                engine.AddObject(currBlock);
            }

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

            //TODO - Task 13: Implementing Shooting Ability
            Racket newRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);
            engine.AddObject(theRacket);
        }
Esempio n. 35
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol   = WorldCols - 2;

            // "paint" blocks
            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, 2),
                                    new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            //TrailObject trailObject = new TrailObject(new MatrixCoords(4, 4), 3);
            //engine.AddObject(trailObject);

            // Таск 7
            // Test the MeteoriteBall by replacing the normal ball in the AcademyPopcornMain.cs file.

            //MeteoriteBall mBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2 + 1, 1), new MatrixCoords(-1, 1), 3);
            //engine.AddObject(mBall);

            // task 9
            // Test the UnpassableBlock and the UnstoppableBall by adding them
            // to the engine in AcademyPopcornMain.cs file

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

            // "paint" unpassable blocks
            //for (int i = startCol; i < endCol; i++)
            //{
            //    UnpassableBlock currBlockTwo = new UnpassableBlock(new MatrixCoords(startRow + 2, i));

            //    engine.AddObject(currBlockTwo);
            //}

            // task 10
            //for (int i = startCol; i < endCol; i++)
            //{
            //    ExplodingBlock exBlock = new ExplodingBlock(new MatrixCoords(startRow + 2, i));
            //    engine.AddObject(exBlock);
            //}

            // task 11
            Gift gift = new Gift(new MatrixCoords(7, 15), new MatrixCoords(1, 0));

            engine.AddObject(gift);

            // task 12
            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(5, 8));

            engine.AddObject(giftBlock);

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

            engine.AddObject(theRacket);

            // task 1
            // 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.
            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock borderBlockLeft = new IndestructibleBlock(new MatrixCoords(row, 0));
                engine.AddObject(borderBlockLeft);
            }

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

            for (int coll = 0; coll < WorldCols; coll++)
            {
                IndestructibleBlock borderBlockRight = new IndestructibleBlock(new MatrixCoords(0, coll));
                engine.AddObject(borderBlockRight);
            }
        }
Esempio n. 36
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol   = WorldCols - 2;

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

                engine.AddObject(currBlock);
                engine.AddObject(currBlock0);
            }

            //ExplodingBlock makes trails
            ExplodingBlock explodingBlock = new ExplodingBlock(new MatrixCoords(4, 7));

            engine.AddObject(explodingBlock);

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

            //Meteorite Ball makes trails when it moves
            //MeteoriteBall meteroitBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            // engine.AddObject(meteroitBall);

            //Unstoppable Ball, can be stopped only by Unpassable Block
            UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0),
                                                                  new MatrixCoords(-1, 1));

            engine.AddObject(unstoppableBall);

            //Falling gift
            Gift giftObject = new Gift(new MatrixCoords(5, 15),
                                       new MatrixCoords(-1, 0));

            engine.AddObject(giftObject);

            //Gift Block
            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(10, 10));

            engine.AddObject(giftBlock);

            //UnpassableBlock
            UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(15, 15));

            engine.AddObject(unpassableBlock);
            UnpassableBlock unpassableBlock1 = new UnpassableBlock(new MatrixCoords(15, 16));

            engine.AddObject(unpassableBlock1);
            UnpassableBlock unpassableBlock2 = new UnpassableBlock(new MatrixCoords(15, 17));

            engine.AddObject(unpassableBlock2);

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

            engine.AddObject(theRacket);

            //Creating second Racket
            //When you add second racket by addObject method, it checks whether the game has already a racket
            //If it does, we are removing the previous, and adding the new one.
            //Racket secondRacket = new Racket(new MatrixCoords(WorldRows -10, WorldCols / 2), RacketLength);
            //engine.AddObject(secondRacket);

            TrailObject trailObject = new TrailObject(new MatrixCoords(1, 1), 20);

            engine.AddObject(trailObject);

            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock indestructibleBlockLeft  = new IndestructibleBlock(new MatrixCoords(i, 0));
                IndestructibleBlock indestructibleBlockRight = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));
                engine.AddObject(indestructibleBlockLeft);
                engine.AddObject(indestructibleBlockRight);
            }

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

            for (int i = startRow; i < WorldRows; ++i)
            {
                IndestructibleBlock indestructibleBlockLeft  = new IndestructibleBlock(new MatrixCoords(i, 0));
                IndestructibleBlock indestructibleBlockRight = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));

                engine.AddObject(indestructibleBlockLeft);
                engine.AddObject(indestructibleBlockRight);
            }

            for (int i = 0; i < WorldCols; ++i)
            {
                IndestructibleBlock indestructibleBlockTop = new IndestructibleBlock(new MatrixCoords(startRow - 1, i));

                engine.AddObject(indestructibleBlockTop);
            }

            Random random = new Random();

            for (int row = 0; row < 3; ++row)
            {
                for (int i = startCol; i < endCol; i++)
                {
                    int   rand = random.Next(4);
                    Block currBlock;
                    if (rand == 0)
                    {
                        currBlock = new ExplodingBlock(new MatrixCoords(startRow + row, i));
                    }
                    else if (rand == 1)
                    {
                        currBlock = new GiftBlock(new MatrixCoords(startRow + row, i));
                    }
                    else if (rand == 2)
                    {
                        currBlock = new UnpassableBlock(new MatrixCoords(startRow + row, i));
                    }
                    else
                    {
                        currBlock = new Block(new MatrixCoords(startRow + row, i));
                    }
                    engine.AddObject(currBlock);
                }
            }

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

            engine.AddObject(theBall);

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

            engine.AddObject(theRacket);

            engine.AddObject(new TrailObject(new MatrixCoords(WorldRows - 1, 2), 5));
        }
Esempio n. 38
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol   = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                if (i == 11) // Testing the explosion object
                {
                    engine.AddObject(new Block(new MatrixCoords(startRow, i)));
                    engine.AddObject(new Block(new MatrixCoords(startRow + 1, i)));
                    engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow + 2, i)));
                }
                else if (i == 35) // Testing the gift Object
                {
                    engine.AddObject(new Block(new MatrixCoords(startRow, i)));
                    engine.AddObject(new Block(new MatrixCoords(startRow + 1, i)));
                    engine.AddObject(new GiftBlock(new MatrixCoords(startRow + 2, i)));
                }
                else
                {
                    engine.AddObject(new Block(new MatrixCoords(startRow, i)));
                    engine.AddObject(new Block(new MatrixCoords(startRow + 1, i)));
                    engine.AddObject(new Block(new MatrixCoords(startRow + 2, i)));
                }
            }

            // 09. Adding Unpassable wall
            for (int i = endCol / 2; i < endCol / 2 + 4; i++)
            {
                engine.AddObject(new UnpassableBlock(new MatrixCoords(startRow + 3, i)));
            }

            // 01. Adding the ceiling
            // Adding the top wall
            startCol -= 2;
            startRow -= 2;
            for (int i = startCol; i < WorldCols; i++)
            {
                IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(startRow, i));
                engine.AddObject(topWall);
            }

            // Adding the left wall
            startRow = 2;
            startCol = 0;
            for (int i = startRow; i < WorldRows; i++)
            {
                IndestructibleBlock currWall = new IndestructibleBlock(new MatrixCoords(i, startCol));
                engine.AddObject(currWall);
            }

            // Adding the right wall
            startRow = 2;
            startCol = WorldCols - 1;
            for (int i = startRow; i < WorldRows; i++)
            {
                IndestructibleBlock currWall = new IndestructibleBlock(new MatrixCoords(i, startCol));
                engine.AddObject(currWall);
            }

            // 07. Testing the metheorite ball
            Ball theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));

            // 09. Testing the unstappable ball
            //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);

            // 05. Initialize Trailing object
            //TrailObject simpleTrailObject = new TrailObject(new MatrixCoords(10, 10), new char[,] {{'o'}}, 10);
            //engine.AddObject(simpleTrailObject);

            // 11. Testing the gift Object
            //Gift testGift = new Gift(new MatrixCoords(WorldRows / 2, 10), new char[,] {{'8'}}, new MatrixCoords(1, 0));
            //engine.AddObject(testGift);
        }
Esempio n. 39
0
        public void Initialize(Engine engine)
        {
            // Initialize ceiling
            for (int i = wallStartRow; i < WorldCols; i++)
            {
                Block ceiling = new IndestructibleBlock(new MatrixCoords(wallStartRow, i));
                engine.AddObject(ceiling);
            }

            // Initialize indestructible walls
            for (int i = wallStartRow + 1; i < WorldRows; i++)
            {
                Block leftWallBlock  = new IndestructibleBlock(new MatrixCoords(i, 0));
                Block rightWallBlock = new IndestructibleBlock(new MatrixCoords(i, GetCols - 1));
                engine.AddObject(leftWallBlock);
                engine.AddObject(rightWallBlock);
            }

            // Initialize exploding Blocks
            for (int i = startCol; i < endCol; i++)
            {
                if (i % 7 == 0)
                {
                    Block explBlock = new ExplodingBlock(new MatrixCoords(startRow + 1, i));
                    engine.AddObject(explBlock);
                }
            }

            // Initialize Unpassable Blocks
            for (int i = startCol; i < endCol; i++)
            {
                if (i % 5 == 0)
                {
                    Block unpassableBlock = new UnpassableBlock(new MatrixCoords(WorldRows / 2, i));
                    engine.AddObject(unpassableBlock);
                }
            }

            // Initialize Gift Blocks
            for (int i = startCol; i < endCol; i++)
            {
                if (i % 8 == 0)
                {
                    Block currBlock = new GiftBlock(new MatrixCoords(startRow - 1, i));
                    engine.AddObject(currBlock);
                }
            }

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

            // Original Ball

            //ball theball = new ball(new matrixcoords(worldrows / 2, 0),
            //new matrixcoords(-1, 1));

            //engine.addobject(theball);

            // Meteorite Ball Test

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


            // Unstoppable Ball Test

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

            engine.AddObject(theBall);

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

            engine.AddObject(theRacket);
        }
Esempio n. 40
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);
        }
Esempio n. 41
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);

            // Exercise 1 - add side walls and ceiling wall
            for (int col = 0; col < WorldCols; col++)
            {
                Block indestructibleBlock = new IndestructibleBlock(new MatrixCoords(0, col));

                engine.AddObject(indestructibleBlock);
            }

            for (int row = 0; row < WorldRows; row++)
            {
                Block indestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, 0));

                engine.AddObject(indestructibleBlock);

                indestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));

                engine.AddObject(indestructibleBlock);
            }

            // Exercise 5 - TrailObject test
            //TrailObject trailObject = new TrailObject(new MatrixCoords(10, 15), LifeTime);
            //engine.AddObject(trailObject);

            // Exercise 7 - Replace the normal ball with a meteorite ball
            //Ball meteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1), TrailLifeTime);

            //engine.AddObject(meteoriteBall);

            // Exercise 9 - Test the UnstoppableBall and the UnpassableBlock
            //for (int i = startCol; i < endCol / 2; i++)
            //{
            //    Block currBlock = new UnpassableBlock(new MatrixCoords(startRow + 1, i));

            //    engine.AddObject(currBlock);
            //}

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

            //engine.AddObject(ustoppableBall);

            // Exercise 10 - Test the Explosion and the ExplosionBlock
            //Block explosionBlock = new ExplosionBlock(new MatrixCoords(startRow + 1, 7));
            //engine.AddObject(explosionBlock);

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

            // Exercise 12 - Test the GiftBlock and the Gift
            //for (int i = startCol; i < endCol; i++)
            //{
            //    Block giftBlock = new GiftBlock(new MatrixCoords(startRow + 1, i));

            //    engine.AddObject(giftBlock);
            //}

            // Exercise 13 - Shooting racket test
            for (int i = startCol; i < endCol; i++)
            {
                Block giftBlock = new GiftBlock(new MatrixCoords(startRow + 1, i));

                engine.AddObject(giftBlock);
            }

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

            engine.AddObject(theRacket);
        }
Esempio n. 42
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 += 2)
            {
                ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow + 1, i));

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

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

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

                engine.AddObject(currBlock);
            }

            for (int i = 1; i < WorldRows; i++)
            {
                IndestructibleBlock newIndestructubleBlock = new IndestructibleBlock(new MatrixCoords(i, 0), '║');
                engine.AddObject(newIndestructubleBlock);
                newIndestructubleBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1), '║');
                engine.AddObject(newIndestructubleBlock);
            }
            for (int i = 1; i < WorldCols - 1; i++)
            {
                IndestructibleBlock newIndestructubleBlock = new IndestructibleBlock(new MatrixCoords(0, i), '═');
                engine.AddObject(newIndestructubleBlock);
                newIndestructubleBlock = new IndestructibleBlock(new MatrixCoords(WorldRows - 1, i), '_');
                engine.AddObject(newIndestructubleBlock);
            }

            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);
        }
        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++)
            {
                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);
            }
            for (int i = startCol; i < endCol / 3; i++)
            {
                UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(startRow + 4, i));

                engine.AddObject(currBlock);
            }

            // Exploding blocks. Chain reaction :)
            for (int i = endCol / 2; i < endCol; i++)
            {
                ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow + 3, i));

                engine.AddObject(currBlock);
            }

            //Gift testGift = new Gift(new MatrixCoords(10, 20));
            //engine.AddObject(testGift);

            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(7, 25));

            engine.AddObject(giftBlock);

            // TASK 1
            startCol = 0;
            endCol   = WorldRows - 1;

            for (int i = startRow; i < endCol; i++) // LEFT SIDE
            {
                IndestructibleBlock currBlock = new IndestructibleBlock(new MatrixCoords(i, startCol));

                engine.AddObject(currBlock);
            }

            startCol = WorldCols - 1;

            for (int i = startRow; i < endCol; i++) // RIGHT SIDE
            {
                IndestructibleBlock currBlock = new IndestructibleBlock(new MatrixCoords(i, startCol));

                engine.AddObject(currBlock);
            }

            startRow = 2;
            startCol = 0;
            endCol   = WorldCols;

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

                engine.AddObject(currBlock);
            }

            // END TASK 1

            // Bellow the three balls are added to the engine
            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
                                    new MatrixCoords(-1, 1));

            MeteoriteBall theMeteoriteBall = new MeteoriteBall(new MatrixCoords(20, 9),
                                                               new MatrixCoords(-1, 1));

            UnstoppableBall theUnstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 25),
                                                                     new MatrixCoords(-1, 1));

            engine.AddObject(theBall);
            engine.AddObject(theMeteoriteBall);
            engine.AddObject(theUnstoppableBall);

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

            engine.AddObject(theRacket);


            // Part of TASK 5
            //TrailObject trailObject = new TrailObject(new MatrixCoords(10, 20), 5);

            //engine.AddObject(trailObject);
        }
Esempio n. 44
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);
        }
        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);
            }
        }
        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);
            }
            //10
            ExplodingBlock exBlock = new ExplodingBlock(new MatrixCoords(4, 30));

            engine.AddObject(exBlock);
            //END 10

            //01.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.

            for (int row = 0; row < 40; row++)
            {
                IndestructibleBlock leftSideBlock  = new IndestructibleBlock(new MatrixCoords(row, 0));
                IndestructibleBlock rightSideBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));
                engine.AddObject(leftSideBlock);
                engine.AddObject(rightSideBlock);
            }

            for (int col = 0; col < WorldCols; col++)
            {
                IndestructibleBlock ceilingBlock = new IndestructibleBlock(new MatrixCoords(0, col));
                engine.AddObject(ceilingBlock);
            }
            //END 01

            //05
            TrailObject trailObj = new TrailObject(new MatrixCoords(8, 8), 8);
            //engine.AddObject(trailObj);
            //END 05

            //07.Test the MeteoriteBall by replacing the normal ball in the AcademyPopcornMain.cs file.
            MeteoriteBall metBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));

            engine.AddObject(metBall);
            //END 07

            //09
            ImpassableBlock imPassBlock = new ImpassableBlock(new MatrixCoords(4, 7));

            engine.AddObject(imPassBlock);
            UnstoppableBall unstopBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0),
                                                             new MatrixCoords(-1, 1));
            //engine.AddObject(unstopBall);
            //END 09

            //12
            GiftBlock gift = new GiftBlock(new MatrixCoords(7, 25));

            engine.AddObject(gift);
            //END 12

            //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;

            //1. 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.

            //LeftWall
            for (int i = 0; i < endCol; i++)
            {
                IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(i, 0));

                engine.AddObject(leftWall);
            }

            //RightWall
            for (int i = 0; i < endCol; i++)
            {
                IndestructibleBlock rightWall = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));

                engine.AddObject(rightWall);
            }

            //Ceiling
            for (int i = 1; i < WorldCols - 1; i++)
            {
                IndestructibleBlock rightWall = new IndestructibleBlock(new MatrixCoords(0, i));

                engine.AddObject(rightWall);
            }

            //10. Testing the exploding block.
            for (int i = startCol; i < endCol; i++)
            {
                //if (i == 7)
                //{
                //    ExplodingBlock boomBlock = new ExplodingBlock(new MatrixCoords(startRow, i));
                //
                //    engine.AddObject(boomBlock);
                //}
                //else
                //{
                    Block currBlock = new Block(new MatrixCoords(startRow, i));

                    engine.AddObject(currBlock);
                //}
            }

            //12. Testing Gift and GiftBlock
            for (int i = startCol; i < endCol; i++)
            {
                GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow + 5, i));

                engine.AddObject(currBlock);
            }

            //7. Test the MeteoriteBall by replacing the normal ball in the AcademyPopcornMain.cs file.
            //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);

            //5. Testing TrailObject
            //TrailObject trail = new TrailObject(new MatrixCoords(10, 10), 5);
            //
            //engine.AddObject(trail);

            //9. Test the UnpassableBlock and the UnstopableBall by adding them to the engine in AcademyPopcornMain.cs file.
            //for (int i = 5; i < 20; i++)
            //{
            //    UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(8, i));
            //
            //    engine.AddObject(unpassableBlock);
            //}
            //
            //UnstopableBall theBall = new UnstopableBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            //
            //engine.AddObject(theBall);

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

            engine.AddObject(theBall);
        }
        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);

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

            //Implement UnstopableBall and UnpassableBlocks
            //UnstoppableBall theUnstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            //engine.AddObject(theUnstoppableBall);

            for (int i = 0; i < WorldRows; i++)
            {
                UnpassableBlock LeftWall = new UnpassableBlock(new MatrixCoords(i, 0));
                UnpassableBlock RightWall = new UnpassableBlock(new MatrixCoords(i, WorldCols - 1));
                engine.AddObject(LeftWall);
                engine.AddObject(RightWall);
            }
            for (int i = 1; i < WorldCols - 1; i++)
            {
                UnpassableBlock UppertWall = new UnpassableBlock(new MatrixCoords(0, i));
                engine.AddObject(UppertWall);
            }

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

            //Add indistructuble blocks
            for (int i = 1; i < WorldRows; i++)
            {
                IndestructibleBlock LeftWall = new IndestructibleBlock(new MatrixCoords(i, 1));
                IndestructibleBlock RightWall = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 2));
                engine.AddObject(LeftWall);
                engine.AddObject(RightWall);
            }
            for (int i = 2; i < WorldCols - 2; i++)
            {
                IndestructibleBlock UppertWall = new IndestructibleBlock(new MatrixCoords(1, i));
                engine.AddObject(UppertWall);
            }

            //Adding several explosion blocks
            for (int i = 7; i < WorldCols-2; i+=7)
            {
                ExplodingBlock explosion = new ExplodingBlock(new MatrixCoords(3, i));
                engine.AddObject(explosion);
            }

            //Add several gift blocks
            for (int i = 2; i < WorldCols - 2; i += 7)
            {
                GiftBlock giftBlock = new GiftBlock(new MatrixCoords(4, i));
                engine.AddObject(giftBlock);
            }

            //Add shooting rocket
            ShootingRacket shoot = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);
            engine.AddObject(shoot);
        }
        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);


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


            //Implement UnstopableBall and UnpassableBlocks
            //UnstoppableBall theUnstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            //engine.AddObject(theUnstoppableBall);

            for (int i = 0; i < WorldRows; i++)
            {
                UnpassableBlock LeftWall  = new UnpassableBlock(new MatrixCoords(i, 0));
                UnpassableBlock RightWall = new UnpassableBlock(new MatrixCoords(i, WorldCols - 1));
                engine.AddObject(LeftWall);
                engine.AddObject(RightWall);
            }
            for (int i = 1; i < WorldCols - 1; i++)
            {
                UnpassableBlock UppertWall = new UnpassableBlock(new MatrixCoords(0, i));
                engine.AddObject(UppertWall);
            }

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

            //Add indistructuble blocks
            for (int i = 1; i < WorldRows; i++)
            {
                IndestructibleBlock LeftWall  = new IndestructibleBlock(new MatrixCoords(i, 1));
                IndestructibleBlock RightWall = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 2));
                engine.AddObject(LeftWall);
                engine.AddObject(RightWall);
            }
            for (int i = 2; i < WorldCols - 2; i++)
            {
                IndestructibleBlock UppertWall = new IndestructibleBlock(new MatrixCoords(1, i));
                engine.AddObject(UppertWall);
            }

            //Adding several explosion blocks
            for (int i = 7; i < WorldCols - 2; i += 7)
            {
                ExplodingBlock explosion = new ExplodingBlock(new MatrixCoords(3, i));
                engine.AddObject(explosion);
            }

            //Add several gift blocks
            for (int i = 2; i < WorldCols - 2; i += 7)
            {
                GiftBlock giftBlock = new GiftBlock(new MatrixCoords(4, i));
                engine.AddObject(giftBlock);
            }

            //Add shooting rocket
            ShootingRacket shoot = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

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

            // standart blocks

            #region Standart Blocks

            for (int row = 2; row < 5; row++)
            {
                for (int col = startCol; col < endCol; col++)
                {
                    Block standartBlock = new Block(new MatrixCoords(row, col));
                    engine.AddObject(standartBlock);
                }
            }

            #endregion

            #region GameField Walls

            for (int row = 0; row < WorldRows - 2; row++)
            {
                IndestructibleBlock leftWallBlock  = new IndestructibleBlock(new MatrixCoords(row + 2, startCol - 2));
                IndestructibleBlock rightWallBlock = new IndestructibleBlock(new MatrixCoords(row + 2, endCol + 1));
                engine.AddObject(rightWallBlock);
                engine.AddObject(leftWallBlock);
            }

            for (int col = 0; col < WorldCols; col++)
            {
                IndestructibleBlock topWallBlock = new IndestructibleBlock(new MatrixCoords(startRow - 2, col));
                engine.AddObject(topWallBlock);
            }

            #endregion

            #region Impassable Blocks

            for (int col = 1; col < WorldCols - 1; col++)
            {
                //if (col == 1 || col == 2) continue;
                ImpassableBlock imBlock = new ImpassableBlock(new MatrixCoords(11, col));
                engine.AddObject(imBlock);
            }

            #endregion

            #region Explosion Blocks

            for (int col = 2; col < WorldCols - 1; col += 1)
            {
                ExplodingBlock expBlock = new ExplodingBlock(new MatrixCoords(5, col));
                engine.AddObject(expBlock);
            }

            #endregion

            #region Gift Blocks

            for (int col = 1; col < WorldCols - 1; col += 5)
            {
                GiftBlock giftBlocks = new GiftBlock(new MatrixCoords(6, col));
                engine.AddObject(giftBlocks);
            }

            #endregion

            Ball 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);
        }
        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 + 3, i));

                engine.AddObject(currBlock);

                Block otherBlock = new Block(new MatrixCoords(19, i));

                engine.AddObject(otherBlock);

                if (i > 19 && i < 30)
                {
                    // add unpassableBlocks
                    UnpassableBlock currUnpassableBlock = new UnpassableBlock(new MatrixCoords(18, i + 1));

                    engine.AddObject(currUnpassableBlock);
                }
            }

            // add GiftBlock
            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(8, 15));

            engine.AddObject(giftBlock);

            // add explodingBlock
            ExplodingBlock explodingBlock  = new ExplodingBlock(new MatrixCoords(startRow + 4, startCol + 1));
            ExplodingBlock explodingBlock1 = new ExplodingBlock(new MatrixCoords(startRow + 14, startCol + 19));

            engine.AddObject(explodingBlock);
            engine.AddObject(explodingBlock1);

            // add disapiared object
            TrailObject trailObject = new TrailObject(new MatrixCoords(17, 5), new char[, ] {
                { 'X', 'X', 'X' }
            }, 100);

            engine.AddObject(trailObject);

            for (int row = startRow - 1; row < WorldRows; row++)
            {
                IndestructibleBlock leftWallBlock  = new IndestructibleBlock(new MatrixCoords(row, 0));
                IndestructibleBlock rightWallBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));

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

            for (int col = 0; col < WorldCols; col++)
            {
                IndestructibleBlock upWallBlock = new IndestructibleBlock(new MatrixCoords(1, col));

                engine.AddObject(upWallBlock);
            }

            // change ball
            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);

            // test we should remove the previous racket from this.allObjects
            //engine.AddObject(theRacket);
        }
Esempio n. 52
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol   = WorldCols - 2;


            //01.   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.
            for (int i = 0; i < WorldRows; i++)
            {
                Block LeftBorder  = new IndestructibleBlock(new MatrixCoords(i, 0));
                Block RigthBorder = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));

                engine.AddObject(LeftBorder);
                engine.AddObject(RigthBorder);
            }

            for (int i = 0; i < WorldCols - 1; i++)
            {
                Block UpBorder = new IndestructibleBlock(new MatrixCoords(0, i));

                engine.AddObject(UpBorder);
            }


            ////Task 02 - test sleeptime
            //engine.SleepTime = 100;


            ////Task 05 - test the TrailObject by adding an instance of it in the engine through the AcademyPopcornMain.cs file.
            //TrailObject trail = new TrailObject(new MatrixCoords(WorldRows / 2, WorldCols / 2), new char[,] { { '%' } }, 20);
            //engine.AddObject(trail);


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

            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 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
            //for (int i = 10; i < WorldCols - 10; i++)
            //{
            //    //create an unpassable block
            //    UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(10, i));
            //    engine.AddObject(unpassableBlock);
            //}

            //UnstoppableBall ultimateBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 10), new MatrixCoords(-1, 1));
            //engine.AddObject(ultimateBall);


            ////10.   Test ExplodingBlock
            //for (int i = startCol; i < endCol; i++)
            //{
            //    if (i % 2 == 0)
            //    {
            //        ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow + 1, i));
            //        engine.AddObject(currBlock);
            //    }
            //    else
            //    {
            //        Block currBlock = new Block(new MatrixCoords(startRow + 1, i));
            //        engine.AddObject(currBlock);
            //    }
            //}


            ////12.   Test the Gift and GiftBlock classes by adding them through the AcademyPopcornMain.cs file.
            //for (int i = startCol + 5; i < endCol - 5; i++)
            //{
            //    GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow + 10, i));
            //    engine.AddObject(currBlock);
            //}


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

                engine.AddObject(currBlock);
            }

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

            engine.AddObject(theRacket);


            //TODO - Task 13: Implementing Shooting Ability
            Racket newRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
        }