static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } for (int i = startCol + 10; i < endCol - 5; i++) { UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(startRow + 5, i)); engine.AddObject(currBlock); } for (int i = startCol + 12; i < endCol - 7; i += 3) { ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow + 3, i)); engine.AddObject(currBlock); } for (int i = startCol; i < endCol; i += 3) { GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow + 8, i)); engine.AddObject(currBlock); } UnstopableBall theBall = new UnstopableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); //Task 1 for (int i = 0; i < WorldRows; i++) { IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1)); engine.AddObject(indBlock); indBlock = new IndestructibleBlock(new MatrixCoords(i, 0)); engine.AddObject(indBlock); } for (int i = 1; i < WorldCols - 1; i++) { IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(0, i)); engine.AddObject(indBlock); } }
const int SleepTime = 100; //Task02 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); } //------ //Task01 //------ //Under Task09 changed the IndestructibleBlock with UnpassableBlock for (int i = 0; i < WorldCols; i++) { UnpassableBlock ceilingBlock = new UnpassableBlock(new MatrixCoords(1, i)); engine.AddObject(ceilingBlock); } for (int i = 2; i < WorldRows; i++) { UnpassableBlock leftWallBlock = new UnpassableBlock(new MatrixCoords(i, 0)); engine.AddObject(leftWallBlock); UnpassableBlock rigthWallBlock = new UnpassableBlock(new MatrixCoords(i, WorldCols - 1)); engine.AddObject(rigthWallBlock); } //------ //------ //Task05 //------ engine.AddObject(new TrailObject(new MatrixCoords(5, 15), new char[, ] { { '$' } }, 150)); //------ /*Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), * new MatrixCoords(-1, 1));*/ //------ //Task07 //------ /*MeteorBall theBall = new MeteorBall(new MatrixCoords(WorldRows / 2, 0), * new MatrixCoords(-1, 1));*/ //------ //------ //Task09 //------ engine.AddObject(new UnpassableBlock(new MatrixCoords(WorldRows / 2 - 7, 6))); engine.AddObject(new UnpassableBlock(new MatrixCoords(WorldRows / 2 - 7, 7))); UnstopableBall theBall = new UnstopableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); //------ //------ //Task10 //------ for (int i = WorldCols / 2; i < WorldCols - 2; i++) { engine.AddObject(new ExplodingBlock(new MatrixCoords(2, i))); } //------ //------ //Task12 //------ for (int i = WorldCols / 2; i < WorldCols - 2; i++) { engine.AddObject(new GiftBlock(new MatrixCoords(WorldRows / 2 - 7, i))); } //------ engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } // Task 1 - 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); }