/* Legend: G - gift block X - gift (the block that is dropped after G is hit) E - the exploding block * - TrailObject (used by the meteorite ball or after explosion of ExplodingBlock) @ - bullet fired by the racket % - ExplosionBlockResult blocks */ static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } // build ceiling and left wall for the scene for (int i = 0; i < endCol; i++) { Block ceilingBlock = new IndestructibleBlock(new MatrixCoords(0, i)); Block leftWallBlock = new IndestructibleBlock(new MatrixCoords(i, 0)); engine.AddObject(ceilingBlock); engine.AddObject(leftWallBlock); } // build right wall for the scene for (int i = 0; i < WorldRows; i++) { Block rightWallBlock = new IndestructibleBlock(new MatrixCoords(i, endCol - 1)); engine.AddObject(rightWallBlock); } // meteorite or unstoppable ball test Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); Racket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); // test trail object with random MatrixCoords and lifetime = 15 turns GameObject trailObj = new TrailObject(new MatrixCoords(WorldRows - 6, WorldCols - 12), 15); engine.AddObject(trailObj); // add a gift block Block giftBlock = new GiftBlock(new MatrixCoords(WorldRows - 11, WorldCols - 20)); engine.AddObject(giftBlock); //add unpassable block with random coords Block unpassable = new UnpassableBlock(new MatrixCoords(WorldRows - 15, WorldCols - 10)); engine.AddObject(unpassable); // add exploding block and ordinary blocks around it Block explodingBlock = new ExplodingBlock(new MatrixCoords(WorldRows - 12, WorldCols - 35)); Block leftToExploding = new Block(explodingBlock.TopLeft + new MatrixCoords(0, -1)); Block rightToExploding = new Block(explodingBlock.TopLeft + new MatrixCoords(0, 1)); engine.AddObject(explodingBlock); engine.AddObject(leftToExploding); engine.AddObject(rightToExploding); }
public void ShootPlayerRacket() { if (this.playerRacket is ShootingRacket) { ShootingRacket currentPlayerRacket = this.playerRacket as ShootingRacket; currentPlayerRacket.Shoot = true; } }
public void ShootPlayerRacket() { if (this.playerRacket is ShootingRacket) { ShootingRacket shotingRacket = this.playerRacket as ShootingRacket; shotingRacket.IsShooting = true; } }
public override void AddObject(GameObject obj) { var as_racket = obj as ShootingRacket; if (as_racket != null) { racket = as_racket; } base.AddObject(obj); }
//overriding of this method is important for task 13 in order to get access to the fields of the current racket public override void AddObject(GameObject obj) { if (obj is ShootingRacket) { ShootingRacket newRacket = obj as ShootingRacket; this.playerRacket = newRacket; } base.AddObject(obj); }
public override IEnumerable<GameObject> ProduceObjects() { List<ShootingRacket> shootingRacket = new List<ShootingRacket>(); if (this.IsDestroyed) { ShootingRacket newRacket = new ShootingRacket(new MatrixCoords(this.TopLeft.Row + 1, this.TopLeft.Col - 3), 6); newRacket.AvailableBullets = 5; shootingRacket.Add(newRacket); } return shootingRacket; }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; //Problem One - Create ceiling wall for (int i = 0; i < WorldCols; i++) { IndestructibleBlock ceilBlock = new IndestructibleBlock(new MatrixCoords(0, i)); engine.AddObject(ceilBlock); } //Problem One - Create side walls for (int i = 0; i < WorldRows; i++) { IndestructibleBlock leftBlock = new IndestructibleBlock(new MatrixCoords(i, 0)); IndestructibleBlock rightBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1)); engine.AddObject(leftBlock); engine.AddObject(rightBlock); } for (int i = startCol; i < endCol; i++) { //Problem Nine - Test UnpassableBlock //UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(startRow, i)); //Problem Ten - Test ExplodingBlock //ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow, i)); //Problem Twelve - Test GiftBlock GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } //Problem Seven - Test MeteoriteBall //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //Problem Nine - Test UnstoppableBall UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); //Problem Thirteen - Test ShootingRacket ShootingRacket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
public override IEnumerable<GameObject> ProduceObjects() { if (this.IsDestroyedByRacket) { // TODO create fire racket var racketTopLeft = new MatrixCoords(this.topLeft.Row + 1, this.topLeft.Col); var racket = new ShootingRacket(racketTopLeft, 6); return new GameObject[] { racket }; } return base.ProduceObjects(); }
public override IEnumerable <GameObject> ProduceObjects() { if (this.IsDestroyedByRacket) { // TODO create fire racket var racketTopLeft = new MatrixCoords(this.topLeft.Row + 1, this.topLeft.Col); var racket = new ShootingRacket(racketTopLeft, 6); return(new GameObject[] { racket }); } return(base.ProduceObjects()); }
public override IEnumerable <GameObject> ProduceObjects() { if (this.IsDestroyed) { ShootingRacket shooter = new ShootingRacket(new MatrixCoords(topLeft.Row + 1, topLeft.Col - 3), 6); List <GameObject> shooterList = new List <GameObject>(); shooterList.Add(shooter); return(shooterList); } else { return(new List <GameObject>()); } }
public override IEnumerable<GameObject> ProduceObjects() { if (this.IsDestroyed) { ShootingRacket shooter = new ShootingRacket(new MatrixCoords(topLeft.Row+1, topLeft.Col-3), 6); List<GameObject> shooterList = new List<GameObject>(); shooterList.Add(shooter); return shooterList; } else { return new List<GameObject>(); } }
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); }
public override IEnumerable <GameObject> ProduceObjects() { if (this.IsDestroyed) { List <ShootingRacket> rackets = new List <ShootingRacket>(); ShootingRacket shootingRacket = new ShootingRacket( new MatrixCoords(this.TopLeft.Row + 1, this.TopLeft.Col), 6); rackets.Add(shootingRacket); return(rackets); } else { return(base.ProduceObjects()); } }
public override IEnumerable<GameObject> ProduceObjects() { if (this.IsDestroyed) { List<ShootingRacket> racket = new List<ShootingRacket>(); ShootingRacket shootingRacket = new ShootingRacket( new MatrixCoords(this.TopLeft.Row + 1, this.TopLeft.Col - 3), 6); racket.Add(shootingRacket); return racket; } else { return base.ProduceObjects(); } }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; //task one for (int i = 0; i < WorldCols; i++) { IndestructibleBlock ceilBlock = new IndestructibleBlock(new MatrixCoords(0, i)); engine.AddObject(ceilBlock); } for (int i = 0; i < WorldRows; i++) { IndestructibleBlock leftBlock = new IndestructibleBlock(new MatrixCoords(i, 0)); IndestructibleBlock rightBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1)); engine.AddObject(leftBlock); engine.AddObject(rightBlock); } // //nineth task //tenth task //twelfth task for (int i = startCol; i < endCol; i++) { GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } //seventh task //nineth task UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); //thirdteenth task ShootingRacket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; // 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); }
public override IEnumerable<GameObject> ProduceObjects() { if (this.IsDestroyed) { List<ShootingRacket> rackets = new List<ShootingRacket>(); // replace the ordinary racket with a shooting one ShootingRacket shootingRacket = new ShootingRacket( new MatrixCoords(this.TopLeft.Row + 1, this.TopLeft.Col), 6); rackets.Add(shootingRacket); return rackets; } else { return base.ProduceObjects(); } }
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)); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; //The AcademyPopcorn class contains an IndestructibleBlock class. Use it to create side and ceiling walls to the game. You can ONLY edit the AcademyPopcornMain.cs file IndestructibleBlock indestructibleBlock = null; for (int row = 0; row < WorldRows; row++) { for (int col = 0; col < WorldCols; col++) { if (row == 0) { indestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, col)); engine.AddObject(indestructibleBlock); } else if (col == 0 || col == WorldCols - 1) { indestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, col)); engine.AddObject(indestructibleBlock); } } } for (int i = startCol; i < endCol; i++) { switch (i % 5) { case 0: ExplodingBlock explodingBlock = new ExplodingBlock(new MatrixCoords(startRow, i)); engine.AddObject(explodingBlock); break; default: switch (i % 3) { case 0: GiftBlock giftBlock = new GiftBlock(new MatrixCoords(startRow, i)); engine.AddObject(giftBlock); break; default: Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); break; } break; } } for (int i = 4; i < endCol; i+=3) { UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(8, i)); engine.AddObject(currBlock); } TrailObject to = new TrailObject(new MatrixCoords(5, 6), 15); engine.AddObject(to); UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); ShootingRacket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; //The AcademyPopcorn class contains an IndestructibleBlock class. Use it to create side and ceiling walls to the game. You can ONLY edit the AcademyPopcornMain.cs file IndestructibleBlock indestructibleBlock = null; for (int row = 0; row < WorldRows; row++) { for (int col = 0; col < WorldCols; col++) { if (row == 0) { indestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, col)); engine.AddObject(indestructibleBlock); } else if (col == 0 || col == WorldCols - 1) { indestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, col)); engine.AddObject(indestructibleBlock); } } } for (int i = startCol; i < endCol; i++) { switch (i % 5) { case 0: ExplodingBlock explodingBlock = new ExplodingBlock(new MatrixCoords(startRow, i)); engine.AddObject(explodingBlock); break; default: switch (i % 3) { case 0: GiftBlock giftBlock = new GiftBlock(new MatrixCoords(startRow, i)); engine.AddObject(giftBlock); break; default: Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); break; } break; } } for (int i = 4; i < endCol; i += 3) { UnpassableBlock currBlock = new UnpassableBlock(new MatrixCoords(8, i)); engine.AddObject(currBlock); } TrailObject to = new TrailObject(new MatrixCoords(5, 6), 15); engine.AddObject(to); UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); ShootingRacket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); // Exercise 1 - add side walls and ceiling wall for (int col = 0; col < WorldCols; col++) { Block indestructibleBlock = new IndestructibleBlock(new MatrixCoords(0, col)); engine.AddObject(indestructibleBlock); } for (int row = 0; row < WorldRows; row++) { Block indestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, 0)); engine.AddObject(indestructibleBlock); indestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1)); engine.AddObject(indestructibleBlock); } // Exercise 5 - TrailObject test //TrailObject trailObject = new TrailObject(new MatrixCoords(10, 15), LifeTime); //engine.AddObject(trailObject); // Exercise 7 - Replace the normal ball with a meteorite ball //Ball meteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1), TrailLifeTime); //engine.AddObject(meteoriteBall); // Exercise 9 - Test the UnstoppableBall and the UnpassableBlock //for (int i = startCol; i < endCol / 2; i++) //{ // Block currBlock = new UnpassableBlock(new MatrixCoords(startRow + 1, i)); // engine.AddObject(currBlock); //} //Ball ustoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //engine.AddObject(ustoppableBall); // Exercise 10 - Test the Explosion and the ExplosionBlock //Block explosionBlock = new ExplosionBlock(new MatrixCoords(startRow + 1, 7)); //engine.AddObject(explosionBlock); //for (int i = endCol / 2; i < endCol; i++) //{ // Block expBlock = new ExplosionBlock(new MatrixCoords(startRow + 1, i)); // engine.AddObject(expBlock); //} // Exercise 12 - Test the GiftBlock and the Gift //for (int i = startCol; i < endCol; i++) //{ // Block giftBlock = new GiftBlock(new MatrixCoords(startRow + 1, i)); // engine.AddObject(giftBlock); //} // Exercise 13 - Shooting racket test for (int i = startCol; i < endCol; i++) { Block giftBlock = new GiftBlock(new MatrixCoords(startRow + 1, i)); engine.AddObject(giftBlock); } Racket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); }
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++) { if (i % 4 == 0) { GiftBlock giftBlock = new GiftBlock(new MatrixCoords(startRow + 2, i)); engine.AddObject(giftBlock); } else { Block currBlock = new Block(new MatrixCoords(startRow + 2, i)); engine.AddObject(currBlock); } } // [Task 1] Adding left and right wall for (int row = startRow - 1; row < WorldRows; row++) { IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(row, startCol - 1)); engine.AddObject(leftWall); IndestructibleBlock rightWall = new IndestructibleBlock(new MatrixCoords(row, endCol)); engine.AddObject(rightWall); } // [Task 1] Adding ceiling wall for (int col = startCol - 1; col < endCol; col++) { IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(startRow - 1, col)); engine.AddObject(topWall); } Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 1), new MatrixCoords(-1, 1)); engine.AddObject(theBall); //UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 1), // new MatrixCoords(-1, 1)); //engine.AddObject(unstoppableBall); //Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); //engine.AddObject(theRacket); ShootingRacket shootingRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(shootingRacket); //Gift testGift = new Gift(new MatrixCoords(7, 15)); //engine.AddObject(testGift); //Bullet testBullet = new Bullet(new MatrixCoords(20, 15)); //engine.AddObject(testBullet); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); //Implement MetheoridBall //MeteoriteBall meteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //engine.AddObject(meteoriteBall); //Implement UnstopableBall and UnpassableBlocks //UnstoppableBall theUnstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //engine.AddObject(theUnstoppableBall); for (int i = 0; i < WorldRows; i++) { UnpassableBlock LeftWall = new UnpassableBlock(new MatrixCoords(i, 0)); UnpassableBlock RightWall = new UnpassableBlock(new MatrixCoords(i, WorldCols - 1)); engine.AddObject(LeftWall); engine.AddObject(RightWall); } for (int i = 1; i < WorldCols - 1; i++) { UnpassableBlock UppertWall = new UnpassableBlock(new MatrixCoords(0, i)); engine.AddObject(UppertWall); } //Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); //engine.AddObject(theRacket); //Add indistructuble blocks for (int i = 1; i < WorldRows; i++) { IndestructibleBlock LeftWall = new IndestructibleBlock(new MatrixCoords(i, 1)); IndestructibleBlock RightWall = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 2)); engine.AddObject(LeftWall); engine.AddObject(RightWall); } for (int i = 2; i < WorldCols - 2; i++) { IndestructibleBlock UppertWall = new IndestructibleBlock(new MatrixCoords(1, i)); engine.AddObject(UppertWall); } //Adding several explosion blocks for (int i = 7; i < WorldCols-2; i+=7) { ExplodingBlock explosion = new ExplodingBlock(new MatrixCoords(3, i)); engine.AddObject(explosion); } //Add several gift blocks for (int i = 2; i < WorldCols - 2; i += 7) { GiftBlock giftBlock = new GiftBlock(new MatrixCoords(4, i)); engine.AddObject(giftBlock); } //Add shooting rocket ShootingRacket shoot = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(shoot); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); Block currBlock2 = new Block(new MatrixCoords(startRow + 2, i)); engine.AddObject(currBlock2); } Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), 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(WorldRows / 2, 0), // new MatrixCoords(-1, 1), 3); // engine.AddObject(MatrixCoords); //9.Test the UnpassableBlock and the UnstoppableBall by adding them to the engine in AcademyPopcornMain.cs file UnstoppableBall unstopBall=new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(unstopBall); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); //add side walls /*1.The AcademyPopcorn class contains an IndestructibleBlock class. Use it to create side and ceiling walls to the game. * You can ONLY edit the AcademyPopcornMain.cs file. */ for (int row = 0; row < WorldRows; row++) { IndestructibleBlock leftWallBlock = new IndestructibleBlock(new MatrixCoords(row, 0)); engine.AddObject(leftWallBlock); IndestructibleBlock rightWallBlock = new IndestructibleBlock(new MatrixCoords(row,WorldCols-1)); engine.AddObject(rightWallBlock); } for (int row = 0; row < WorldCols; row++) { IndestructibleBlock topper = new IndestructibleBlock(new MatrixCoords(0, row)); engine.AddObject(topper); // IndestructibleBlock bottem = new IndestructibleBlock(new MatrixCoords(WorldRows-2, row)); // engine.AddObject(bottem); } for (int i = 1; i < WorldCols; i+=5) { ExplodingBlock explosion = new ExplodingBlock(new MatrixCoords(3, i)); engine.AddObject(explosion); } for (int i = 1; i < WorldCols; i += 5) { GiftBlock giftBlock = new GiftBlock(new MatrixCoords(4, i)); engine.AddObject(giftBlock); } ShootingRacket shoot = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(shoot); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow + 2, i)); GiftBlock currBlock2 = new GiftBlock(new MatrixCoords(startRow + 4, i)); engine.AddObject(currBlock); engine.AddObject(currBlock2); if (i < endCol / 4) // Exercise 9, 10 { UnpassableBlock currUBlock = new UnpassableBlock(new MatrixCoords(startRow + 0, i));// Exercise 9 engine.AddObject(currUBlock); if (i % 3 == 0)// Exercise 10 { ExplodingBlock currEBlock = new ExplodingBlock(new MatrixCoords(startRow + 3, i));// Exercise 10 engine.AddObject(currEBlock); } } } for (int i = 0; i < WorldCols; i++) // added. Exercise 1 { IndestructibleBlock currBlock1=new IndestructibleBlock(new MatrixCoords(0,i)); engine.AddObject(currBlock1); } for (int i = 1; i < WorldRows; i++) // added. Exercise 1 { IndestructibleBlock currBlock1 = new IndestructibleBlock(new MatrixCoords(i, 0)); IndestructibleBlock currBlock2 = new IndestructibleBlock(new MatrixCoords(i, WorldCols-1)); engine.AddObject(currBlock1); engine.AddObject(currBlock2); } // added. Exercise 5 TrailObject trObj1 = new TrailObject(new MatrixCoords(20, 36), new char[,] {{ 'f' }}, 10); engine.AddObject(trObj1); TrailObject trObj2 = new TrailObject(new MatrixCoords(15, 27), new char[,] { { 'R' } }, 15); engine.AddObject(trObj2); // // replaced with MeteoriteBall //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); // //Exercise 7; replaced with UnstoppableBall //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); // Exercise 9 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); ShootingRacket theRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); //Exercise 13 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 a few gift blocks for (int i = startCol; i < endCol; i++) { GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow + 1, i)); engine.AddObject(currBlock); } Ball ball = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(ball); // test the meteorite ball //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //engine.AddObject(theBall); // test the unstoppable ball //UnstoppableBall unstoppable = new UnstoppableBall(new MatrixCoords(5, 5), // new MatrixCoords(1, 1)); //engine.AddObject(unstoppable); //Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); //engine.AddObject(theRacket); ShootingRacket shootingRacket = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2)); engine.AddObject(shootingRacket); // add left side int topMost = 2; int leftMost = 1; int sideHeight = 20; for (int i = topMost; i < sideHeight + topMost; i++) { engine.AddObject(new IndestructibleBlock(new MatrixCoords(i, leftMost))); } // add ceiling int ceilingWidth = 39; for (int i = leftMost; i < ceilingWidth; i++) { engine.AddObject(new IndestructibleBlock(new MatrixCoords(2, i))); } // add right side int rightMost = 38; for (int i = topMost; i < sideHeight + topMost; i++) { engine.AddObject(new IndestructibleBlock(new MatrixCoords(i, rightMost))); } // add exploding blocks topMost += 3; for (int i = topMost; i < sideHeight; i++) { engine.AddObject(new ExplodingBlock(new MatrixCoords(i, 25))); } // add gifts engine.AddObject(new Gift(new MatrixCoords(5, 5))); engine.AddObject(new Gift(new MatrixCoords(6, 9))); engine.AddObject(new Gift(new MatrixCoords(5, 14))); }
public void ShootPlayerRacket(ShootingRacket racket) { racket.ProduceObjects(); }
public void ShootPlayerRacket() { racket = this.playerRacket as ShootingRacket; racket.Shoot(); }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); } Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theBall); //Implement MetheoridBall //MeteoriteBall meteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //engine.AddObject(meteoriteBall); //Implement UnstopableBall and UnpassableBlocks //UnstoppableBall theUnstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //engine.AddObject(theUnstoppableBall); for (int i = 0; i < WorldRows; i++) { UnpassableBlock LeftWall = new UnpassableBlock(new MatrixCoords(i, 0)); UnpassableBlock RightWall = new UnpassableBlock(new MatrixCoords(i, WorldCols - 1)); engine.AddObject(LeftWall); engine.AddObject(RightWall); } for (int i = 1; i < WorldCols - 1; i++) { UnpassableBlock UppertWall = new UnpassableBlock(new MatrixCoords(0, i)); engine.AddObject(UppertWall); } //Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); //engine.AddObject(theRacket); //Add indistructuble blocks for (int i = 1; i < WorldRows; i++) { IndestructibleBlock LeftWall = new IndestructibleBlock(new MatrixCoords(i, 1)); IndestructibleBlock RightWall = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 2)); engine.AddObject(LeftWall); engine.AddObject(RightWall); } for (int i = 2; i < WorldCols - 2; i++) { IndestructibleBlock UppertWall = new IndestructibleBlock(new MatrixCoords(1, i)); engine.AddObject(UppertWall); } //Adding several explosion blocks for (int i = 7; i < WorldCols - 2; i += 7) { ExplodingBlock explosion = new ExplodingBlock(new MatrixCoords(3, i)); engine.AddObject(explosion); } //Add several gift blocks for (int i = 2; i < WorldCols - 2; i += 7) { GiftBlock giftBlock = new GiftBlock(new MatrixCoords(4, i)); engine.AddObject(giftBlock); } //Add shooting rocket ShootingRacket shoot = new ShootingRacket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(shoot); }