상속: AcademyPopcorn.Ball
예제 #1
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

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

                engine.AddObject(currBlock);
            }

            //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 secondBlock = new Block(new MatrixCoords(startRow + 1, i));
                engine.AddObject(secondBlock);
            }

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

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

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

            //engine.AddObject(theBall);

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

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

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

            engine.AddObject(theRacket);

            for (int i = 0; i < WorldRows; i++)
            {
                engine.AddObject(new IndestructibleBlock(new MatrixCoords(i, 0)));
                engine.AddObject(new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1)));
            }
            for (int i = 0; i < WorldCols; i++)
            {
                engine.AddObject(new IndestructibleBlock(new MatrixCoords(0, i)));
            }
            for (int i = 0; i < WorldCols; i++)
            {
                engine.AddObject(new GameOverBlock(new MatrixCoords(WorldRows, i)));
            }
            engine.AddTrailingObject(new TrailObject(new MatrixCoords(15, 20), new char[,] { { 'S', 't', 'a', 'r', 't' }, { 'G', 'a', 'm', 'e', ' ' } }, 10));
        }
        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);
            }

            // 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);
        }
예제 #6
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);
        }
예제 #7
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol   = WorldCols - 2;

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


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

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

                engine.AddObject(currBlock);
            }

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

            engine.AddObject(trailer);

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

            engine.AddObject(theBall);

            // the racket - moves with A/D and space shoots
            Racket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

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

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

                engine.AddObject(currBlock);
            }

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

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

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

                engine.AddObject(currBlock);
            }

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

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

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

            engine.AddObject(theRacket);

        }
예제 #10
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

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

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

            engine.AddObject(theBall);

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

            engine.AddObject(theRacket);

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

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

            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(7,33));
            engine.AddObject(giftBlock);
        }
예제 #11
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

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


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

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

                engine.AddObject(currBlock);
            }

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

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

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

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

                engine.AddObject(currBlock);
            }

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

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

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

            }

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

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

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

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

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

                engine.AddObject(currBlock);
            }

            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);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

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

            CreateFieldBorders(engine, startRow, startCol, endCol);

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

            engine.AddObject(meteoriteBall);

            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++)
            {
                engine.AddObject(new Block(new MatrixCoords(startRow, i)));
            }

            CreateFieldBorders(engine, startRow, startCol, endCol);

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

            engine.AddObject(meteoriteBall);

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

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

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

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

            //engine.AddObject(theBall);

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

            engine.AddObject(theRacket);
            // Task1: CreateWalls
            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(row, 0));
                engine.AddObject(leftWall);
                IndestructibleBlock rightWall=new IndestructibleBlock(new MatrixCoords(row,WorldCols-1));
                engine.AddObject(rightWall);
            }
            for(int col=0;col<WorldCols;col++)
            {
                IndestructibleBlock uperWall=new IndestructibleBlock(new MatrixCoords(0,col));
                engine.AddObject(uperWall);
            }
            //====================================================================================
        }
예제 #17
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);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;
            for (int i = startCol; i < endCol/2; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }
            for (int i = (endCol/2); i < endCol; i++) // making unpassable blocks
            {
                UnpassableBlock unpBlock = new UnpassableBlock(new MatrixCoords(startRow, i));
                engine.AddObject(unpBlock);
            }
            Ball theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2 + 1 , 0), new MatrixCoords(-1, 1));
            Ball unstBall = new UnstoppableBall(new MatrixCoords(10, WorldCols - 1), new MatrixCoords(-1, -1)); //creating unstoppable ball
            engine.AddObject(unstBall);
            engine.AddObject(theBall);
            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);
            engine.AddObject(theRacket);
        }
예제 #19
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);
        }
예제 #20
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++)
            {
                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);
        }
예제 #21
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);
                
            }
            //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;

            // 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);
        }
예제 #24
0
        // Drawing all objects
        static void Initialize(Engine engine)
        {
            // Wall coordinates
            for (int col = 0; col < WorldCols; col += WallGap)
            {
                if (col > WorldCols / 3 && col < 2 * WorldCols / 3) col += WallGap;
                for (int width = col; width < col + WallWidth; width++)
                {
                    for (int row = 0; row <= ((col != 0 && col < WorldCols - WallGap) ? WorldRows - 1 : WorldRows); row++)
                    {
                        if (col != 0 && col < WorldCols - WallGap && row == 2) row = 6;
                        if (col > WallGap && col < WorldCols - WallGap && row == 17) row = 22;
                        IndestructibleBlock Wall = new IndestructibleBlock(new MatrixCoords(row, width));
                        engine.AddObject(Wall);
                    }
                }
            }

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

            // Floor coordinates
            for (int col = 0; col < WorldCols - 1; col++)
            {
                if (col == WallGap + WallWidth) col = 3 * WallGap;
                IndestructibleBlock floor = new IndestructibleBlock(new MatrixCoords(WorldRows - 1, col));
                engine.AddObject(floor);
            }

            // Block coordinates
            for (int row = 0; row < BlockLines; row++)
            {
                if (row == 2) row = 3;
                for (int col = WallGap + WallWidth + 1; col < 3 * WallGap - 1; col++)
                {
                    if (row == 4 && (col == 3 * WallGap / 2 || col == 5 * WallGap / 2)) col++;
                    Block currBlock = new Block(new MatrixCoords(StartBlockRow + row, col));
                    engine.AddObject(currBlock);
                }
            }

            for (int col = WallGap + WallWidth + 1; col < 3 * WallGap - 1; col++)
            {
                if (col == WallGap + 7) col = 3 * WallGap - 5;
                Block currBlock2 = new Block(new MatrixCoords(5, col));
                engine.AddObject(currBlock2);
            }

            for (int row = 0; row < WorldRows - 2 * BlockLines + 1; row += 3)
            {
                for (int col = WallWidth + 1; col < WorldCols - WallWidth - 1; col++)
                {
                    if (col == WallGap - 1) col = 3 * WallGap + WallWidth + 1;
                    Block currBlock = new Block(new MatrixCoords(StartBlockRow + row, col));
                    engine.AddObject(currBlock);
                }
            }

            for (int col = WallGap + WallWidth + 5; col < 3 * WallGap - 5; col++)
            {
                UnpassableBlock unpassBlock = new UnpassableBlock(new MatrixCoords(5, col));
                engine.AddObject(unpassBlock);
            }

            ExplodingBlock exploBlock1 = new ExplodingBlock(new MatrixCoords(7, 3 * WallGap / 2));
            engine.AddObject(exploBlock1);
            ExplodingBlock exploBlock2 = new ExplodingBlock(new MatrixCoords(7, 5 * WallGap / 2));
            engine.AddObject(exploBlock2);

            // Ball coordinates
            Ball theBall = new Ball(new MatrixCoords(2 * WorldRows / 3, WorldCols / 2 - 10), new MatrixCoords(-1, 1));
            engine.AddObject(theBall);

            // Meteorite ball coordinates
            MeteoriteBall meteoBall = new MeteoriteBall(new MatrixCoords(WorldRows - 1, 1), new MatrixCoords(-1, 1));
            engine.AddObject(meteoBall);

            MeteoriteBall meteoBall2 = new MeteoriteBall(new MatrixCoords(WorldRows - 1, 3), new MatrixCoords(-1, 1));
            engine.AddObject(meteoBall2);

            MeteoriteBall meteoBall3 = new MeteoriteBall(new MatrixCoords(WorldRows - 1, 7), new MatrixCoords(-1, 1));
            engine.AddObject(meteoBall3);

            // Unstoppable ball coordinates
            UnstoppableBall unstopBall = new UnstoppableBall(new MatrixCoords(WorldRows - 8, WorldCols - WallWidth - 3), new MatrixCoords(-1, -1));
            engine.AddObject(unstopBall);

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

            // Gift coordinates
            for (int col = WallGap + 3; col < 3 * WallGap - 1; col++)
            {
                GiftBlock gift = new GiftBlock(new MatrixCoords(1, col));
                engine.AddObject(gift);
            }
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;
            int endRow = WorldRows - 1;
            Random ranGen = new Random();

            for (int i = startCol - 1; i < endCol + 1; i++)
            {
                Block currBlock;
                int probability = ranGen.Next(0, 100);
                if (probability < 30)
                {
                    //Task 10:
                    currBlock = new ExplodingBlock(new MatrixCoords(startRow, i));
                }
                else if (probability < 60 && probability >= 30)
                {
                    //Task 12:
                    currBlock = new GiftBlock(new MatrixCoords(startRow, i));
                }
                else
                {
                    currBlock = new Block(new MatrixCoords(startRow, i));
                }
                engine.AddObject(currBlock);

            }

            for (int i = startCol - 2; i < endCol + 2; i++)
            {
                //Task 1: IndestructibleBlock ceiling = new IndestructibleBlock(new MatrixCoords(startRow - 1, i));
                //Task 9:
                UnpassableBlock ceiling = new UnpassableBlock(new MatrixCoords(startRow - 1, i));

                engine.AddObject(ceiling);
            }

            for (int i = startRow; i < endRow + 1; i++)
            {
                //Task 1:
                IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(i, startCol - 2));
                IndestructibleBlock rightWall = new IndestructibleBlock(new MatrixCoords(i, endCol + 1));

                engine.AddObject(rightWall);
                engine.AddObject(leftWall);
            }

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

            engine.AddObject(BallOne);

            //Task 9:
            //UnstoppableBall BallTwo = new UnstoppableBall(new MatrixCoords(WorldRows / 2 + 2, 0),
            //    new MatrixCoords(-1, 1));

            //engine.AddObject(BallTwo);

            //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);
        }
예제 #26
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));
        }
예제 #27
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)));
        }
예제 #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 - first the left wall
            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(i, 0));
                engine.AddObject(indBlock);
            }

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

            // Then the ceiling. 
            // For task 9 I have put Unpassable blocks on the ceiling.
            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock indBlock = new UnpassableBlock(new MatrixCoords(0, i));
                engine.AddObject(indBlock);
            }

            // Testing Task 7 by replacing the normal ball with a Meteorite Ball
            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);

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

            // Task 9 - creating an additional unstopable ball
            Ball theGreatBall = new UnstopableBall(new MatrixCoords(WorldRows / 3, 0),
                new MatrixCoords(-1, 1));
            engine.AddObject(theGreatBall);

            // Task 12 - testing by adding a Gift and a GiftBlock
            Gift theGift = new Gift(new MatrixCoords(10, 10));
            engine.AddObject(theGift);

            GiftBlock theGiftBlock = new GiftBlock(new MatrixCoords(10, 15));
            engine.AddObject(theGiftBlock);
        }
예제 #29
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);
            }
            //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);
        }
예제 #30
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);
            }

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

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

            engine.AddObject(theRacket);

            /*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 = startRow - 1; row < WorldRows; row++)
            {
                IndestructibleBlock leftWallBlock = new IndestructibleBlock(new MatrixCoords(row, startCol - 1),
                    IndestructibleBlock.SymbolWall);
                engine.AddObject(leftWallBlock);
                IndestructibleBlock rightWallBlock = new IndestructibleBlock(new MatrixCoords(row, endCol),
                    IndestructibleBlock.SymbolWall);
                engine.AddObject(rightWallBlock);
            }
            //create ceiling (using symbolTop = "_")
            for (int col = startCol - 1; col < WorldCols - 1; col++)
            {
                IndestructibleBlock topWallBlock = new IndestructibleBlock(new MatrixCoords(1, col),
                    IndestructibleBlock.SymbolTop);
                engine.AddObject(topWallBlock);
            }

            TrailObject comet = new TrailObject(new MatrixCoords(WorldRows / 2, WorldCols / 4), new char[,] { { '*' } }, 8);
            engine.AddObject(comet);

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

            //9.Test the UnpassableBlock and the UnstoppableBall by adding them to the engine in AcademyPopcornMain.cs file
            UnstoppableBall unstopBall = new UnstoppableBall(new MatrixCoords(WorldRows / 3, 0), new MatrixCoords(-1, 1));
            engine.AddObject(unstopBall);

            for (int i = 3; i < WorldCols - 2; i = i + 2)
            {
                UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(4, i), 'U');
                engine.AddObject(unpassableBlock);
            }

            for (int i = 2; i < WorldCols; i = i + 2)
            {
              ExplodingBlock bombBlock = new ExplodingBlock(new MatrixCoords(4, i), 'B');
              engine.AddObject(bombBlock);
            }

            for (int i = 2; i < WorldCols; i = i + 2)
            {
                GiftBlock giftBlock = new GiftBlock(new MatrixCoords(5, i), 'G');
                engine.AddObject(giftBlock);
            }
        }
예제 #31
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);
            }*/

            //Test  class GiftBlock and Gift - Homework Task 12  and  ExplodingBlock - HomeWork Task 10
            for (int i = startCol; i < endCol; i++)
            {
                if (i == 7)
                {
                    ExplodingBlock expBlock = new ExplodingBlock(new MatrixCoords(3, 7));
                    engine.AddObject(expBlock);
                    continue;
                }
                GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow, i));
                engine.AddObject(currBlock);
            }

            //Ceiling wall - Homework Task 01
            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock currentBlock = new IndestructibleBlock(new MatrixCoords(0, i));
                engine.AddObject(currentBlock);
            }

            //Side walls - Homework Task 01
            for (int i = 1; i <= WorldRows; i++)
            {
                IndestructibleBlock currentBlockLeft = new IndestructibleBlock(new MatrixCoords(i, 0));
                IndestructibleBlock currentBlockRight = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));
                engine.AddObject(currentBlockLeft);
                engine.AddObject(currentBlockRight);
            }

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

            // test Meteorite Ball - Homework Task 07
            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 TrailObject - Homework Task 05
            TrailObject testObject = new TrailObject(new MatrixCoords(10, 10), new char[,] { { '@' } }, 5);
            engine.AddObject(testObject);*/

            /* //test Gift
            Gift testGift = new Gift(new MatrixCoords(WorldRows / 5, WorldCols / 5));
            engine.AddObject(testGift);*/
        }
예제 #32
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);
        }
예제 #33
0
        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.
            for (int i = startRow - startCol; i < WorldRows; i++)
            {
                IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(1, i), '—');
                IndestructibleBlock leftSideWall = new IndestructibleBlock(new MatrixCoords(i, startCol - 1));
                IndestructibleBlock righSideWall = new IndestructibleBlock(new MatrixCoords(i, endCol));

                engine.AddObject(topWall);
                engine.AddObject(leftSideWall);
                engine.AddObject(righSideWall);
            }

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

            // Unpassable blocks
            //for (int i = startCol; i < endCol; i++)
            //{
            //    UnpassableBlock unpassBlock = new UnpassableBlock(new MatrixCoords(startRow, i));
            //    engine.AddObject(unpassBlock);
            //}

            // Exploding blocks
            //for (int i = startCol; i < endCol ; i++)
            //{
            //    ExplodingBlock expBlock = new ExplodingBlock(new MatrixCoords(startRow, i));
            //    engine.AddObject(expBlock);
            //}

            // Gift blocks
            //for (int i = startCol; i < endCol; i++)
            //{
            //    GiftBlock giftBlock = new GiftBlock(new MatrixCoords(startRow, i));
            //    engine.AddObject(giftBlock);
            //}

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

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

            // 9. Test the UnpassableBlock and the UnstoppableBall by adding them to the engine in AcademyPopcornMain.cs file.
            //UnstoppableBall theUnstoppableBall = new UnstoppableBall(new MatrixCoords(WorldCols - 2, WorldRows / 2),
            //    new MatrixCoords(-1, -1));
            //engine.AddObject(theUnstoppableBall);

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

            // Trail
            //TrailObject trail = new TrailObject(new MatrixCoords(10, 3), 10);
            //engine.AddObject(trail);
        }
예제 #34
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);
        }
예제 #35
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++)
            {
                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);
        }
예제 #36
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startRow; i < startRow+3; i++)
            {
                for (int j = startCol; j < endCol; j++)
                {
                    Block currBlock;
                    if ((i == startRow+3) && (j == startCol+3))
                    {
                        // 10. Test ExplodingBlock
                        currBlock = new ExplodingBlock(new MatrixCoords(i, j));
                    }
                    else if ((i == startRow + 3) && (j == endCol - 3))
                    {
                        // 12. Test the Gift and GiftBlock classes
                        currBlock = new GiftBlock(new MatrixCoords(i, j));
                    }
                    else
                    {
                        currBlock = new Block(new MatrixCoords(i, j));
                    }
                    engine.AddObject(currBlock);
                }
            }

            // Is comment to test Meteorite Ball
            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            //engine.AddObject(theBall);

            // Is comment to test Unstoppable Ball
            // 7. Test the MeteoriteBall by replacing the normal ball
            Ball theMeteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(theMeteoriteBall);

            // Is commented to test ExplodingBlocks
            // 9. Test the UnpassableBlock and the UnstoppableBall
            //Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            //engine.AddObject(theUnstopableBall);

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

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

            // 1. The AcademyPopcorn class contains an IndestructibleBlock class.
            // Use it to create side and ceiling walls to the game.
            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 upWallBlock = new IndestructibleBlock(new MatrixCoords(0, col));
                engine.AddObject(upWallBlock);
            }

            // 5. Then test the TrailObject by adding an instance of it in the engine through the AcademyPopcornMain.cs file.
            //char[,] symbol = new char[1,1];
            //symbol[0, 0] = '*';
            //TrailObject trail = new TrailObject(new MatrixCoords(5,5), symbol, 10);
            //engine.AddObject(trail);
        }
        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++)
            {
                //Adding a ExplodingBlock aka bomb here
                if (i == 18)
                {
                    ExplodingBlock bomb = new ExplodingBlock(new MatrixCoords(startRow + 1, i));
                    engine.AddObject(bomb);
                    continue;
                }
                //Adding a gift here
                if (i == endCol - 2)
                {
                    GiftBlock gift = new GiftBlock(new MatrixCoords(startRow + 1, i));
                    engine.AddObject(gift);
                    continue;
                }
                Block currBlock = new Block(new MatrixCoords(startRow + 1, i));
                engine.AddObject(currBlock);
            }
            //Task 1
            for (int i = startCol; i < endCol; i++)
            {
                //Start from 0 where is the start of the matrix
                Block indeBlock = new IndestructibleBlock(new MatrixCoords(i, 0));

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

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

                engine.AddObject(indeBlock);
            }
            //End of task 1

            //Task 5
            char[,] startChar = { { 'M', 'o', 'v', 'e', ' ', 'w', 'i', 't', 'h', ' ', '\'', 'a', '\'', ' ', 'a', 'n', 'd', ' ', '\'', 'd', '\'' } };
            TrailObject startMsg = new TrailObject(new MatrixCoords(0, 0), startChar, 20);
            engine.AddObject(startMsg);
            //End of Task 5

            //Task 7
            Ball theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));
            engine.AddObject(theBall);
            //End of task 7

            //Task 9  - UnpassableBlock added
            for (int i = startCol + 5; i < endCol - 17; i++)
            {
                Block unpassBlock = new UnpassableBlock(new MatrixCoords(startRow + 9, i));

                engine.AddObject(unpassBlock);
            }

            //Adding unstoppable Ball to the game at some position
            //When the ball destroys more than it should - it's from the colision detection
            Ball unstopBall = new UnstoppableBall(new MatrixCoords(20, 5),
                new MatrixCoords(-1, 1));
            engine.AddObject(unstopBall);
            //End of task 9

            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;

            #region Add Indestructible Blocks as ball delimeters

            for (int row = 0; row < WorldRows; row++)
            {
                for (int col = 0; col < WorldCols; col++)
                {
                    IndestructibleBlock currBlock = null;
                    if (row == 0)
                    {
                        currBlock = new IndestructibleBlock(new MatrixCoords(row, col));
                        engine.AddObject(currBlock);
                    }
                    else
                    {
                        if (col == 0 || col == WorldCols - 1)
                        {
                            currBlock = new IndestructibleBlock(new MatrixCoords(row, col));
                            engine.AddObject(currBlock);
                        }
                    }

                }
            }
            #endregion

            #region Add TrailObject

            //TrailObject trailObject = new TrailObject(new MatrixCoords(WorldRows, WorldCols),
            //                                          new char[,] { { '°' } }, 5);
            //engine.AddObject(trailObject);

            #endregion

            #region Add Blocks

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

            #region Add unpassable Blocks

            //for (int i = startCol; i < endCol; i = i + 4)
            //{
            //    UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(startRow + 5, i));

            //    engine.AddObject(unpassableBlock);
            //}
            for (int i = startCol; i < endCol; i = i + 3)
            {
                UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(WorldRows - 8, i));

                engine.AddObject(unpassableBlock);
            }
            #endregion

            #region Add exploding Blocks

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

                engine.AddObject(expoldingBlock);
            }
            #endregion

            #region Add gift Blocks

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

                engine.AddObject(giftBlock);
            }
            #endregion

            #region Add Meteorite Ball

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

            #endregion

            #region Add unstoppableBall Ball

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

            #endregion

            #region Add Ball

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

            engine.AddObject(theBall);

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

            engine.AddObject(theRacket);
        }
예제 #39
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));
        }