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); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects //the solution is above, in AddObject() this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { this.allObjects.RemoveAll(item => item is Racket); this.staticObjects.RemoveAll(item => item is Racket); this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
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 theBall = new Ball(new MatrixCoords(WorldRows / 2, 2), new MatrixCoords(-1, 1)); engine.AddObject(theBall); TrailObject trailObject = new TrailObject(theBall.TopLeft, 3); engine.AddObject(trailObject); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 1; int endCol = WorldCols - 1; int endRow = 10; //generate level for (int i = startCol; i < endCol; i++) { for (int j = startRow; j < endRow; j++) { Block currBlock = BlockFactory.GetBlock(generator.Next(1, 10), new MatrixCoords(j, i)); engine.AddObject(currBlock); } } //Ball theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2 + 1 , 0), new MatrixCoords(-1, 1)); Ball megaBall = new UnstoppableBall(new MatrixCoords(WorldRows - 1, WorldCols / 2 + 1), new MatrixCoords(-1, 1)); engine.AddObject(megaBall); //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); } AddGameFieldWalls(engine); AddUnpassableBlocks(engine); AddExplodingBlocks(engine); AddGiftBlocks(engine); AddBall(engine); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength * 2); engine.AddObject(theRacket); }
private void AddRacket(GameObject obj) { // remove the previous racket from this.allObjects and this.staticObjects RemoveRacket(); this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects //03. Search for a "TODO" in the Engine class, regarding the AddRacket method. // Solve the problem mentioned there. There should always be only one Racket. // Note: comment in TODO not completely correct for (int i = 0; i < allObjects.Count; i++) { if (allObjects[i] is Racket) { allObjects.RemoveAt(i); break; } } for (int i = 0; i < staticObjects.Count; i++) { if (staticObjects[i] is Racket) { staticObjects.RemoveAt(i); break; } } this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); engine.AddObject(new UnpassableBlock(new MatrixCoords(3, i * 4))); } engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow + 1, 6))); engine.AddObject(new GiftBlock(new MatrixCoords(startRow + 1, endCol - 2))); Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); //Ball theBall = new MeteoritBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); //Ball theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } for (int i = 0; i < endCol + 2; i++) { engine.AddObject(new IndestructibleBlock(new MatrixCoords(startRow - 1, i))); } for (int i = startRow; i < 32; i++) { engine.AddObject(new IndestructibleBlock(new MatrixCoords(i, 0))); engine.AddObject(new IndestructibleBlock(new MatrixCoords(i, endCol + 1))); } UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1), -1); engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
/* Search for a "TODO" in the Engine class, regarding the AddRacket method. Solve the problem mentioned there. * There should always be only one Racket. Note: comment in TODO not completely correct*/ private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects RemovePreviousRacket(); this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 1; int endCol = WorldCols - 1; int endRow = 10; //generate level for (int i = startCol; i < endCol; i++) { for (int j = startRow; j < endRow; j++) { Block currBlock = BlockFactory.GetBlock(generator.Next(1, 10), new MatrixCoords(j, i)); engine.AddObject(currBlock); } } //Ball theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2 + 1 , 0), new MatrixCoords(-1, 1)); Ball megaBall = new UnstoppableBall(new MatrixCoords(WorldRows - 1, WorldCols/2 +1), new MatrixCoords(-1, 1)); engine.AddObject(megaBall); //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; Random rnd = new Random(); for (int i = startCol; i < endCol; i++) { if (rnd.Next(startCol, WorldCols*2)> endCol) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } else if (rnd.Next(startCol, WorldCols * 3) > endCol) { ExplodingBlock boomBlock = new ExplodingBlock(new MatrixCoords(startRow, i)); engine.AddObject(boomBlock); } else if (rnd.Next(startCol, WorldCols * 4) > endCol) { GiftBlock giftBlock = new GiftBlock(new MatrixCoords(startRow, i)); engine.AddObject(giftBlock); } else { UnpassableBlock unpBlock = new UnpassableBlock(new MatrixCoords(startRow, i)); engine.AddObject(unpBlock); } } MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); Racket newtheRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength + 1); engine.AddObject(newtheRacket); // Add side wallsя for (int row = 0; row < WorldRows; row++) { IndestructibleBlock leftWallBlock = new IndestructibleBlock(new MatrixCoords(row, 0)); engine.AddObject(leftWallBlock); IndestructibleBlock rightWallBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1)); engine.AddObject(rightWallBlock); } for (int col = 0; col < WorldCols; col++) { IndestructibleBlock roof = new IndestructibleBlock(new MatrixCoords(0, col)); engine.AddObject(roof); } }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } for (int i = startCol + 10; i < endCol - 5; i++) { UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(startRow + 5, i)); engine.AddObject(currBlock); } for (int i = startCol + 12; i < endCol - 7; i += 3) { ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow + 3, i)); engine.AddObject(currBlock); } for (int i = startCol; i < endCol; i += 3) { GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow + 8, i)); engine.AddObject(currBlock); } UnstopableBall theBall = new UnstopableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); //Task 1 for (int i = 0; i < WorldRows; i++) { IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1)); engine.AddObject(indBlock); indBlock = new IndestructibleBlock(new MatrixCoords(i, 0)); engine.AddObject(indBlock); } for (int i = 1; i < WorldCols - 1; i++) { IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(0, i)); engine.AddObject(indBlock); } }
private void AddRacket(GameObject obj) { //all previous Rackets removed this.allObjects.RemoveAll(x => x is Racket); this.staticObjects.RemoveAll(x => x is Racket); this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { //Task 3 this.allObjects.Remove(this.playerRacket); this.staticObjects.Remove(this.playerRacket); this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects this.RemoveStaticObject(obj); //Task03 this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects int coun = this.allObjects.RemoveAll(x => (x as Racket) != null); this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { this.allObjects.RemoveAll(item => item is Racket); // [Task 3] this.staticObjects.RemoveAll(item => item is Racket); // [Task 3] this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects this.playerRacket = obj as Racket; this.allObjects.RemoveAll(ob => ob is Racket); this.staticObjects.RemoveAll(ob => ob is Racket); this.AddStaticObject(obj); }
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); } // 01. Adding the ceiling // Adding the top wall startCol -= 2; startRow -= 2; for (int i = startCol; i < WorldCols; i++) { IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(startRow, i)); engine.AddObject(topWall); } // Adding the left wall startRow = 2; startCol = 0; for (int i = startRow; i < WorldRows; i++) { IndestructibleBlock currWall = new IndestructibleBlock(new MatrixCoords(i, startCol)); engine.AddObject(currWall); } // Adding the right wall startRow = 2; startCol = WorldCols - 1; for (int i = startRow; i < WorldRows; i++) { IndestructibleBlock currWall = new IndestructibleBlock(new MatrixCoords(i, startCol)); engine.AddObject(currWall); } Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); // 05. Initialize Trailing object // !!! The Object disapears instantly - Must find why!!! TrailObject simpleTrailObject = new TrailObject(new MatrixCoords(10, 10), new char[, ] { { '$' } }, 500); engine.AddObject(simpleTrailObject); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects // Task 3 this.allObjects.ToList().Remove(this.playerRacket); this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
static void Initialize(Engine engine) { int startRow = 2; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow + 1, i)); engine.AddObject(currBlock); } for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow + 2, i)); engine.AddObject(currBlock); } Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 35), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Ball twoBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(twoBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 2, WorldCols / 2), RacketLength); engine.AddObject(theRacket); for (int row = 0; row < WorldRows; row++) { IndestructibleBlock wallLeft = new IndestructibleBlock(new MatrixCoords(row, 0)); engine.AddObject(wallLeft); IndestructibleBlock wallRight = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1)); engine.AddObject(wallRight); } for (int col = 0; col < WorldCols; col++) { IndestructibleBlock wallDown = new IndestructibleBlock(new MatrixCoords(WorldRows - 1, col)); engine.AddObject(wallDown); IndestructibleBlock wallUp = new IndestructibleBlock(new MatrixCoords(startRow - 2, col)); engine.AddObject(wallUp); } }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = 0; i < WorldCols; i++) { IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(0, i)); engine.AddObject(indBlock); } for (int i = 1; i < WorldRows; i++) { IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(i, 0)); engine.AddObject(indBlock); } for (int i = 1; i < WorldRows; i++) { IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1)); engine.AddObject(indBlock); } for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); //engine.AddObject(theBall); //Ball theMeteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); //engine.AddObject(theMeteoriteBall); Ball theUnsBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theUnsBall); UnpassableBlock theUnpasBlock = new UnpassableBlock(new MatrixCoords(WorldRows - 19, WorldCols - 21)); engine.AddObject(theUnpasBlock); GiftBlock theGiftBlock = new GiftBlock(new MatrixCoords(5, 7)); engine.AddObject(theGiftBlock); }
static void Initialize(Engine engine) { int startRow = 2; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow+1, i)); engine.AddObject(currBlock); } for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow + 2, i)); engine.AddObject(currBlock); } Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 35), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Ball twoBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(twoBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 2, WorldCols / 2), RacketLength); engine.AddObject(theRacket); for (int row = 0; row < WorldRows; row++) { IndestructibleBlock wallLeft = new IndestructibleBlock(new MatrixCoords(row,0)); engine.AddObject(wallLeft); IndestructibleBlock wallRight = new IndestructibleBlock(new MatrixCoords(row, WorldCols-1)); engine.AddObject(wallRight); } for (int col = 0; col < WorldCols; col++) { IndestructibleBlock wallDown = new IndestructibleBlock(new MatrixCoords(WorldRows - 1, col)); engine.AddObject(wallDown); IndestructibleBlock wallUp = new IndestructibleBlock(new MatrixCoords(startRow-2, col)); engine.AddObject(wallUp); } }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { if (i == 3) { ExplodingBlock expBlock = new ExplodingBlock(new MatrixCoords(startRow, i)); engine.AddObject(expBlock); continue; } if (i == 2) { GiftBlock giftblock = new GiftBlock(new MatrixCoords(startRow, i)); engine.AddObject(giftblock); continue; } Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } // Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); for (int i = startRow; i < Console.BufferHeight; i++) { engine.AddObject(new UnpassableBlock(new MatrixCoords(i, startCol - 1))); } for (int i = startRow; i < Console.BufferHeight; i++) { engine.AddObject(new UnpassableBlock(new MatrixCoords(i, WorldCols - 2))); } for (int i = startCol-1; i < WorldCols-1; i++) { engine.AddObject(new UnpassableBlock(new MatrixCoords(startRow - 1, i))); } Random rnd = new Random(); for (int i = 0; i < 5; i++) { engine.AddObject(new UnpassableBlock(new MatrixCoords((rnd.Next(0, WorldCols)), (rnd.Next(0, WorldRows))))); } }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } // Add walls for (int i = 0; i < WorldRows; i++) { IndestructibleBlock currLeftWall = new IndestructibleBlock(new MatrixCoords(i, 0)); engine.AddObject(currLeftWall); IndestructibleBlock currRightWall = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1)); engine.AddObject(currRightWall); } //add roof for (int i = 0; i < WorldCols; i++) { IndestructibleBlock currLeftWall = new IndestructibleBlock(new MatrixCoords(0, i), '-'); engine.AddObject(currLeftWall); } Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); //engine.AddObject(theUnstopableBall); //engine.AddObject(new UnpassableBlocks(new MatrixCoords(3, 6))); engine.AddObject(new GiftBlock(new MatrixCoords(4, 6))); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects // 3. Removing the rackets from allObjects and staticObjects this.playerRacket = obj as Racket; this.allObjects.RemoveAll(item => item is Racket); // this line should be as comment if we use multiple rackets this.staticObjects.RemoveAll(item => item is Racket); this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { // task 3 // Search for a "TODO" in the Engine class, regarding the AddRacket method. // Solve the problem mentioned there. There should always be only one Racket. // Note: comment in TODO not completely correct this.playerRacket = obj as Racket; this.staticObjects.Add(obj); this.allObjects.Add(obj); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); //if (i == 7)//Task 10 -> the first block that the ball hits is exploadable //{ // currBlock = new ExplodingBlock(new MatrixCoords(startRow, i)); //} //Task 12 - bellow //if (i == endCol - 3) //the second block that the ball hits //{ // currBlock = new GiftBlock(new MatrixCoords(startRow, i)); //} engine.AddObject(currBlock); } // Add walls - Task 1 for (int row = 2; row < WorldRows; row++) { IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(row, 0)); IndestructibleBlock rightWall = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1)); engine.AddObject(leftWall); engine.AddObject(rightWall); } for (int col = 0; col < WorldCols; col++) { IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(2, col)); engine.AddObject(topWall); } // Task 9 - the UnpassableBlock, indestructible block //for (int i = 2; i < WorldCols / 2; i += 4) //{ // engine.AddObject(new UnpassableBlock(new MatrixCoords(4, i))); //} //Task 7 --> Test the MeteoriteBall by replacing the normal ball in the AcademyPopcornMain.cs file. //Ball meteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); //engine.AddObject(meteoriteBall); //Task 9 - > the ball destroys all, but bounces off UnpassableBlocks and the wall (so that we can keep playing :) ) Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theUnstopableBall); //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
private void AddRacket(GameObject obj) { var item = this.allObjects.Find(s => s is Racket); if (item != null) { this.allObjects.Remove(item); } this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects //Task 3: Implementing Removing of all elements of Type Racket from allObjects var toRemove = this.allObjects.OfType<Racket>().ToList(); foreach (var item in toRemove) this.allObjects.Remove(item); this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
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), new [,] {{'#'}}); engine.AddObject(currBlock); } for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow + 1, i), new[,] { { '#' } }); engine.AddObject(currBlock); } for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow + 2, i), new[,] { { '#' } }); engine.AddObject(currBlock); } Racket someRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(someRacket); for (int row = 3; row < WorldRows; row++) { UnpassableBlock leftWall = new UnpassableBlock(new MatrixCoords(row, 1)); engine.AddObject(leftWall); UnpassableBlock rightWall = new UnpassableBlock(new MatrixCoords(row, endCol)); engine.AddObject(rightWall); } for (int col = 1; col <= endCol; col++) { IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(startRow - 1, col)); engine.AddObject(topWall); } //MeteoriteBall meteoriteBall = new MeteoriteBall(new MatrixCoords(7, 7), new MatrixCoords(1, 1)); //engine.AddObject(meteoriteBall); UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(7, 7), new MatrixCoords(1, 1)); engine.AddObject(unstoppableBall); ExplodingBlock explodingBlock = new ExplodingBlock(new MatrixCoords(startRow + 3, 15)); engine.AddObject(explodingBlock); GiftBlock giftBlock = new GiftBlock(new MatrixCoords(startRow + 3, endCol - 1)); engine.AddObject(giftBlock); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects // 03. Removing the old Racket using Lambda // We can also search the whole list of objects and remove the object that is Racket this.allObjects.RemoveAll(item => item is Racket); this.staticObjects.RemoveAll(item => item is Racket); this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects /* 03. Search for a "TODO" in the Engine class, regarding the AddRacket method. * Solve the problem mentioned there. There should always be only one Racket. * Note: comment in TODO not completely correct */ this.playerRacket = obj as Racket; this.allObjects.RemoveAll(x => x is Racket); // should be always one racket this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { for(int i = 0; i < allObjects.Count; i++) { if(allObjects[i] is Racket) { allObjects.RemoveAt(i); break; } } //TODO: we should remove the previous racket from this.allObjects this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects if (this.playerRacket != null) { this.staticObjects.Remove(this.playerRacket); this.allObjects.Remove(this.playerRacket); } this.playerRacket = obj as Racket; this.AddStaticObject(obj); }
private void AddRacket(GameObject obj) { //TODO: we should remove the previous racket from this.allObjects if (obj is ShootingRacket) { this.playerRacket = obj as ShootingRacket; } else { this.playerRacket = obj as Racket; } this.AddStaticObject(obj); }
static void Initialize(Engine engine) { int startRow = 3; int endRow = WorldRows; int startCol = 2; int endCol = WorldCols - 2; //Task 1: Implementing Game field with adding a "for cycle" for rows //Task 10: Using UnpassableBlock for (int row = startRow; row < endRow; row++) { for (int col = startCol; col < endCol; col++) { if (row == startRow) { UnpassableBlock unpassable = new UnpassableBlock(new MatrixCoords(row, col)); engine.AddObject(unpassable); } if (row != startRow && (col == startCol || col == endCol - 1)) { UnpassableBlock unpassable = new UnpassableBlock(new MatrixCoords(row, col)); engine.AddObject(unpassable); } else if (row <= startRow + 5 && row != startRow) { //Task12: Implementing GiftBlock.cs GiftBlock currBlock = new GiftBlock(new MatrixCoords(row, col)); engine.AddObject(currBlock); } } } // Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 10), // new MatrixCoords(-1, 1)); //Task7: Implementing Meteorit Ball //MeteoritBall meteoritBall = new MeteoritBall(new MatrixCoords(WorldRows / 2, 10), new MatrixCoords(-1, 1)); //Task9: Implement Unstoppable ball UnstoppableBall ultimateBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 10), new MatrixCoords(-1, 1)); engine.AddObject(ultimateBall); //TODO - Task 13: Implementing Shooting Ability Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); // <Task 1> IndestructibleBlock ceilingBlock = new IndestructibleBlock(new MatrixCoords(startRow - 1, i)); IndestructibleBlock leftSideBlock = new IndestructibleBlock(new MatrixCoords(i, startCol - 1)); IndestructibleBlock rightSideBlock = new IndestructibleBlock(new MatrixCoords(i, endCol)); engine.AddObject(ceilingBlock); engine.AddObject(leftSideBlock); engine.AddObject(rightSideBlock); engine.AddObject(currBlock); } //<Task 5> TrailObject trailBlock = new TrailObject(new MatrixCoords(WorldRows / 2, WorldCols / 2), new char[, ] { { '&' } }, 30); engine.AddObject(trailBlock); /* <Task 6> * MeteoriteBall mBall = new MeteoriteBall(new MatrixCoords(10, 10), new MatrixCoords(1, 1), 3); * engine.AddObject(mBall); * * <Task9> Test UnstoppableBall * Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); * engine.AddObject(theUnstopableBall); * * for (int i = 2; i < WorldCols/2; i+=4) * { * engine.AddObject(new UnpassableBlock(new MatrixCoords(4, i))); * } */ Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } // 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); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock; if (i == 7) { currBlock = new ExplodingBlock(new MatrixCoords(startRow, i)); } else if (i == endCol - 3) { currBlock = new GiftBlock(new MatrixCoords(startRow, i)); } else { 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); // Task7: Test MeteoriteBall //Ball theMeteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); //engine.AddObject(theMeteoriteBall); #region // Task9 Test UnstoppableBall /*Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); * engine.AddObject(theUnstopableBall); * * for (int i = 2; i < WorldCols/2; i+=4) * { * engine.AddObject(new UnpassableBlock(new MatrixCoords(4, i))); * }*/ #endregion Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); //Task3 Racket newtheRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength + 1); engine.AddObject(newtheRacket); }
// Task 3 - I have decided that, since it was mentioned that the comment in the code was not completely correct and // that the only condition is to have one racket, to keep the original racket. The method checks whether we have // a Racket object in the list of all objects and then, if not, to add the racket.5 protected virtual void AddRacket(GameObject obj) { bool check=true; foreach (var c in this.allObjects) { if (c is Racket) check = false; } if (check) { this.playerRacket = obj as Racket; this.AddStaticObject(obj); } }
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 1> IndestructibleBlock ceilingBlock = new IndestructibleBlock(new MatrixCoords(startRow - 1, i)); IndestructibleBlock leftSideBlock = new IndestructibleBlock(new MatrixCoords(i, startCol - 1)); IndestructibleBlock rightSideBlock = new IndestructibleBlock(new MatrixCoords(i, endCol)); engine.AddObject(ceilingBlock); engine.AddObject(leftSideBlock); engine.AddObject(rightSideBlock); engine.AddObject(currBlock); } //<Task 5> TrailObject trailBlock = new TrailObject(new MatrixCoords(WorldRows / 2, WorldCols / 2), new char[,] { { '&' } }, 30); engine.AddObject(trailBlock); /* <Task 6> MeteoriteBall mBall = new MeteoriteBall(new MatrixCoords(10, 10), new MatrixCoords(1, 1), 3); engine.AddObject(mBall); <Task9> Test UnstoppableBall Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theUnstopableBall); for (int i = 2; i < WorldCols/2; i+=4) { engine.AddObject(new UnpassableBlock(new MatrixCoords(4, i))); } */ Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; engine.AddObject(new TailObject(new MatrixCoords(10, 5), new char[1,1] {{'%'}}, 5)); for (int i = startCol; i < endCol; i++) { Block currBlock2 = new Block(new MatrixCoords(startRow + 1, i)); engine.AddObject(currBlock2); ExplodingBlock currBlock3 = new ExplodingBlock(new MatrixCoords(startRow + 2, i)); engine.AddObject(currBlock3); GiftBlock currBlock4 = new GiftBlock(new MatrixCoords(startRow + 3, i)); engine.AddObject(currBlock4); } for (int i = startCol - 1; i <= endCol; i++) { IndestructibleBlock currBlock = new IndestructibleBlock(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } for (int i = startRow; i <= WorldRows; i++) { IndestructibleBlock currBlock1 = new IndestructibleBlock(new MatrixCoords(i, startCol - 1)); IndestructibleBlock currBlock2 = new IndestructibleBlock(new MatrixCoords(i, endCol )); engine.AddObject(currBlock1); engine.AddObject(currBlock2); } //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Gift gift = new Gift(new MatrixCoords(8, 20)); engine.AddObject(gift); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
//Welcome screen to show the different types of objects used in the game static void WelcomeScreen() { Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Rules of the game:"); Console.WriteLine(" $ - Unpassable block"); Console.WriteLine(" B - Exploding block"); Console.WriteLine(" G - Gift block"); Console.WriteLine(" ♥ - Gift"); Console.WriteLine(" @ - Unstoppable ball"); Console.WriteLine(" o - Meteorite ball"); Console.WriteLine("Press any key to start..."); Racket a = new Racket(new MatrixCoords(1, 1), 4); Console.ReadKey(); Console.ResetColor(); }
private void AddRacket(GameObject obj) { //3.Search for TODO and remove racket. There should always be only one racket. //TODO: we should remove the previous racket from this.allObjects this.playerRacket = obj as Racket; for (int i = 0; i < allObjects.Count; i++) { if (allObjects[i] is Racket) { allObjects.RemoveAt(i); break; } } this.AddStaticObject(obj); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; InitializeBlocks(engine, startRow, startCol, endCol); CreateFieldBorders(engine, startRow, startCol, endCol); Ball theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 2), 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++) { //ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow, i)); GiftBlock giftBlock = new GiftBlock(new MatrixCoords(startRow + 1, i)); // engine.AddObject(currBlock); engine.AddObject(giftBlock); } // upper wall for (int col = 0; col < WorldCols; col++) { UnpassableBlocks block = new UnpassableBlocks(new MatrixCoords(0, col)); engine.AddObject(block); } // left and right wall for (int row = 1; row < WorldRows; row++) { UnpassableBlocks leftblock = new UnpassableBlocks(new MatrixCoords(row, 0)); UnpassableBlocks rIghtblock = new UnpassableBlocks(new MatrixCoords(row, WorldCols - 1)); engine.AddObject(leftblock); engine.AddObject(rIghtblock); } 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); Racket theRacket1 = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength + 3); engine.AddObject(theRacket); engine.AddObject(theRacket1); // Gift gift = new Gift(new MatrixCoords(0, 5)); // 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)); engine.AddObject(currBlock); } Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
private void AddRacket(GameObject obj) { this.playerRacket = obj as Racket; for (int i = 0; i < this.allObjects.Count; i++) { if (this.allObjects[i] is Racket) { this.allObjects.RemoveAt(i); i--; } } for (int i = 0; i < this.staticObjects.Count; i++) { if (this.staticObjects[i] is Racket) { this.staticObjects.RemoveAt(i); i--; } } this.AddStaticObject(obj); }