/* 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 override IEnumerable<GameObject> ProduceObjects() { List<TrailObject> listOfTail = new List<TrailObject>(); TrailObject partOfTheTail = new TrailObject(this.TopLeft, this.tailChar, this.TrailLife); listOfTail.Add(partOfTheTail); return listOfTail; }
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); }
public override IEnumerable<GameObject> ProduceObjects() { List<GameObject> producedObjects = new List<GameObject>(); TrailObject trailingObject = new TrailObject(base.topLeft, new char[,] { { '*' } }, this.TrailLifetime); producedObjects.Add(trailingObject); return producedObjects; }
public override IEnumerable<GameObject> ProduceObjects() { List < GameObject > l1= new List<GameObject>(); TrailObject trObj = new TrailObject(this.topLeft, new char[,] { { 'M' } }, 3); l1.Add(trObj); return l1; }
public override IEnumerable<GameObject> ProduceObjects() { TrailObject tail = new TrailObject(this.GetTopLeft(), 3); List<GameObject> list = new List<GameObject>(); list.Add(tail); return list; }
public override IEnumerable<GameObject> ProduceObjects() { List<TrailObject> trailObj = new List<TrailObject>(); TrailObject trailObject = new TrailObject(this.TopLeft, this.trailBallBody, this.trailLifetime); trailObj.Add(trailObject); return trailObj; }
public override IEnumerable<GameObject> ProduceObjects() { List<TrailObject> array = new List<TrailObject>(); TrailObject trail = new TrailObject(this.topLeft, new char[,] { { '.' } }, TrailLife); array.Add(trail); return array; }
public override IEnumerable<GameObject> ProduceObjects() { TrailObject trail = new TrailObject(this.TopLeft, 3); List<GameObject> trails = new List<GameObject>(); trails.Add(trail); return trails; }
public override IEnumerable <GameObject> ProduceObjects() { List <TrailObject> trailObj = new List <TrailObject>(); TrailObject trailObject = new TrailObject(this.TopLeft, this.trailBallBody, this.trailLifetime); trailObj.Add(trailObject); return(trailObj); }
public override IEnumerable <GameObject> ProduceObjects() { TrailObject trailObject = new TrailObject(base.GetTopLeft(), new char[, ] { { 'x' } }, 3); return(new GameObject[] { trailObject }); }
public override IEnumerable<GameObject> ProduceObjects() { List<TrailObject> producedObjects = new List<TrailObject>(); char[,] trailObjectBody = { { '.' } }; TrailObject trailObject = new TrailObject(base.topLeft, trailObjectBody, 3); producedObjects.Add(trailObject); return producedObjects; }
public override IEnumerable<GameObject> ProduceObjects() { List<TrailObject> trail = new List<TrailObject>(); TrailObject trailObj=new TrailObject(this.TopLeft,this.trailObjBody,this.trailObjLifeTime); trail.Add(trailObj); return trail; }
public override IEnumerable <GameObject> ProduceObjects() { TrailObject tail = new TrailObject(this.GetTopLeft(), 3); List <GameObject> list = new List <GameObject>(); list.Add(tail); return(list); }
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); }
public override IEnumerable<GameObject> ProduceObjects() { IList<TrailObject> listOfTrailObjects = new List<TrailObject>(); var trailObject = new TrailObject(this.GetTopLeft(),3); listOfTrailObjects.Add(trailObject); return listOfTrailObjects; }
public override IEnumerable<GameObject> ProduceObjects() { //create a list of trail objects List<TrailObject> trailOfObjects = new List<TrailObject>(); // add a new trail object to the list TrailObject trailObject = new TrailObject(base.TopLeft, this.trailObjectBody, 3); trailOfObjects.Add(trailObject); return trailOfObjects; }
public override IEnumerable<GameObject> ProduceObjects() { List<TrailObject> tailList = new List<TrailObject>(); TrailObject trailObject = new TrailObject(this.TopLeft, this.TrailObject, this.TrailObjectsNumber); tailList.Add(trailObject); return tailList; }
public override IEnumerable<GameObject> ProduceObjects() { List<TrailObject> comet = new List<TrailObject>(); TrailObject trailObject = new TrailObject(this.TopLeft, this.trailObjectBody, this.trailObjectLifetime); comet.Add(trailObject); return comet; }
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))); }
public override IEnumerable<GameObject> ProduceObjects() { List<TrailObject> tail = new List<TrailObject>(); // add a new trail object at the current position TrailObject trailObject = new TrailObject(this.TopLeft, this.trailObjectBody, this.trailObjectLifetime); tail.Add(trailObject); return tail; }
public override IEnumerable <GameObject> ProduceObjects() { List <GameObject> trail = new List <GameObject>(); TrailObject trailObj = new TrailObject(this.topLeft, new char[, ] { { '&' } }, 3); trail.Add(trailObj); return(trail); }
public override IEnumerable <GameObject> ProduceObjects() { IList <TrailObject> listOfTrailObjects = new List <TrailObject>(); var trailObject = new TrailObject(this.GetTopLeft(), 3); listOfTrailObjects.Add(trailObject); return(listOfTrailObjects); }
public override IEnumerable <GameObject> ProduceObjects() { List <TrailObject> tail = new List <TrailObject>(); // add a new trail object at the current position TrailObject trailObject = new TrailObject(this.TopLeft, this.trailObjectBody, this.trailObjectLifeTime); tail.Add(trailObject); return(tail); }
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; // 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)); // <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; // 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.mooveCount >= this.ballSpeed) { var trails = new TrailObject[Length]; for (int i = 0; i < Length; i++) { trails[i] = new TrailObject(this.TopLeft, (i + 2) * this.ballSpeed); } return(trails); } else { return(base.ProduceObjects()); } }
public override IEnumerable<GameObject> ProduceObjects() { if (this.mooveCount >= this.ballSpeed) { var trails = new TrailObject[Length]; for (int i = 0; i < Length; i++) { trails[i] = new TrailObject(this.TopLeft, (i + 2) * this.ballSpeed); } return trails; } else { return base.ProduceObjects(); } }
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; //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); }
public override IEnumerable<GameObject> ProduceObjects() { trail[0] = new TrailObject(this.TopLeft, 3); return this.trail; }
public override IEnumerable <GameObject> ProduceObjects() { trail[0] = new TrailObject(this.TopLeft, 3); return(this.trail); }
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); }
public virtual void Run() { while (true) { this.renderer.RenderAll(); System.Threading.Thread.Sleep(this.Sleep); this.userInterface.ProcessInput(); this.renderer.ClearQueue(); for (int i = 0; i < this.allObjects.Count; i++) { if (this.allObjects[i] is MeteoriteBall) { MeteoriteBall ball = (MeteoriteBall)this.allObjects[i]; TrailObject trail = new TrailObject(new MatrixCoords(ball.TopLeft.Row, ball.TopLeft.Col), 3); this.renderer.EnqueueForRendering(trail); this.allObjects.Add(trail); } this.allObjects[i].Update(); if (this.allObjects[i] is TrailObject) { TrailObject trail = (TrailObject)this.allObjects[i]; if (trail.Lifetime < 0) { this.allObjects.Remove(trail); continue; } } this.renderer.EnqueueForRendering(this.allObjects[i]); } CollisionDispatcher.HandleCollisions(this.movingObjects, this.staticObjects); List<GameObject> producedObjects = new List<GameObject>(); foreach (var obj in this.allObjects) { producedObjects.AddRange(obj.ProduceObjects()); } this.allObjects.RemoveAll(obj => obj.IsDestroyed); this.movingObjects.RemoveAll(obj => obj.IsDestroyed); this.staticObjects.RemoveAll(obj => obj.IsDestroyed); foreach (var obj in producedObjects) { this.AddObject(obj); } } }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock0 = new Block(new MatrixCoords(startRow-1, i)); Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); engine.AddObject(currBlock0); } //ExplodingBlock makes trails ExplodingBlock explodingBlock = new ExplodingBlock(new MatrixCoords(4,7)); engine.AddObject(explodingBlock); //Ordinary ball //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //engine.AddObject(theBall); //Meteorite Ball makes trails when it moves //MeteoriteBall meteroitBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); // engine.AddObject(meteroitBall); //Unstoppable Ball, can be stopped only by Unpassable Block UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(unstoppableBall); //Falling gift Gift giftObject = new Gift(new MatrixCoords(5, 15), new MatrixCoords(-1, 0)); engine.AddObject(giftObject); //Gift Block GiftBlock giftBlock = new GiftBlock(new MatrixCoords(10, 10)); engine.AddObject(giftBlock); //UnpassableBlock UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(15, 15)); engine.AddObject(unpassableBlock); UnpassableBlock unpassableBlock1 = new UnpassableBlock(new MatrixCoords(15, 16)); engine.AddObject(unpassableBlock1); UnpassableBlock unpassableBlock2 = new UnpassableBlock(new MatrixCoords(15, 17)); engine.AddObject(unpassableBlock2); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); //Creating second Racket //When you add second racket by addObject method, it checks whether the game has already a racket //If it does, we are removing the previous, and adding the new one. //Racket secondRacket = new Racket(new MatrixCoords(WorldRows -10, WorldCols / 2), RacketLength); //engine.AddObject(secondRacket); TrailObject trailObject = new TrailObject(new MatrixCoords(1, 1), 20); engine.AddObject(trailObject); for (int i = 0; i < WorldRows; i++) { IndestructibleBlock indestructibleBlockLeft = new IndestructibleBlock(new MatrixCoords(i,0)); IndestructibleBlock indestructibleBlockRight = new IndestructibleBlock(new MatrixCoords(i, WorldCols-1)); engine.AddObject(indestructibleBlockLeft); engine.AddObject(indestructibleBlockRight); } for (int i = 0; i < WorldCols; i++) { IndestructibleBlock indestructibleBlockCeiling = new IndestructibleBlock(new MatrixCoords(0, i)); engine.AddObject(indestructibleBlockCeiling); } }
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); } }
static void Main(string[] args) { IRenderer renderer = new ConsoleRenderer(WorldRows, WorldCols); IUserInterface keyboard = new KeyboardInterface(); // Engine gameEngine = new Engine(renderer, keyboard); ShootEngineRacket gameEngine = new ShootEngineRacket(renderer, keyboard); keyboard.OnLeftPressed += (sender, eventInfo) => { gameEngine.MovePlayerRacketLeft(); }; keyboard.OnRightPressed += (sender, eventInfo) => { gameEngine.MovePlayerRacketRight(); }; // task 13 //Engine gameEngineShoot = new ShootEngineRacket(renderer, keyboard); keyboard.OnActionPressed += (sender, eventInfo) => { gameEngine.ShootPlayerRacket(); }; /* 01.The AcademyPopcorn class contains an IndestructibleBlock class. Use it to create side and ceiling walls to the game. You can ONLY edit the AcademyPopcornMain.cs file. */ for (int i = 2; i < WorldRows; i++) { IndestructibleBlock rightWall = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1)); IndestructibleBlock leftWall = new IndestructibleBlock(new MatrixCoords(i, 0)); gameEngine.AddObject(leftWall); gameEngine.AddObject(rightWall); } for (int i = 0; i < WorldCols; i++) { IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(2, i)); gameEngine.AddObject(topWall); } // test 05 task TrailObject trailObject = new TrailObject(new MatrixCoords(5, 5), new char[,] { { '*' } }, 20); gameEngine.AddObject(trailObject); Initialize(gameEngine); // gameEngine.Run(); }
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 - 1; i < endCol + 1; i++) { IndestructibleBlock wallBlock = new IndestructibleBlock(new MatrixCoords(startRow - 1, i)); engine.AddObject(wallBlock); } for (int i = startRow; i < WorldRows; i++) { IndestructibleBlock wallBlock = new IndestructibleBlock(new MatrixCoords(i, startCol - 1)); IndestructibleBlock wallBlock2 = new IndestructibleBlock(new MatrixCoords(i, endCol)); engine.AddObject(wallBlock); engine.AddObject(wallBlock2); } //create a row of GiftBlocks for (int i = startCol; i < endCol; i++) { GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow+4, i)); engine.AddObject(currBlock); } //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //replace the normal ball with Meteorite ball //MeteoriteBall theMeteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); //engine.AddObject(theMeteoriteBall); //replace the MeteroriteBall with Unstoppable Ball Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(theUnstopableBall); //put some unpassable blocks for (int i = 2; i < WorldCols; i += 5) { engine.AddObject(new UnpassableBlock(new MatrixCoords(4, i))); } //create a sample Gift for testing Gift gift = new Gift(new MatrixCoords(1, WorldCols / 2)); engine.AddObject(gift); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); TrailObject newTestTrailObject = new TrailObject(new MatrixCoords(startRow + 10, startCol + 10), new char[,] { { 'V' } }, 20); engine.AddObject(newTestTrailObject); engine.AddObject(theRacket); }
public override IEnumerable<GameObject> ProduceObjects() { TrailObject trailObject = new TrailObject(base.GetTopLeft(), new char[,] { { 'x' } }, 3); return new GameObject[] { trailObject }; }
static void Initialize(Engine engine) { int startRow = 3; int startCol = 2; int endCol = WorldCols - 2; for (int i = startCol; i < endCol; i++) { Block currBlock0 = new Block(new MatrixCoords(startRow - 1, i)); Block currBlock = new Block(new MatrixCoords(startRow, i)); engine.AddObject(currBlock); engine.AddObject(currBlock0); } //ExplodingBlock makes trails ExplodingBlock explodingBlock = new ExplodingBlock(new MatrixCoords(4, 7)); engine.AddObject(explodingBlock); //Ordinary ball //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); //engine.AddObject(theBall); //Meteorite Ball makes trails when it moves //MeteoriteBall meteroitBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), // new MatrixCoords(-1, 1)); // engine.AddObject(meteroitBall); //Unstoppable Ball, can be stopped only by Unpassable Block UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1)); engine.AddObject(unstoppableBall); //Falling gift Gift giftObject = new Gift(new MatrixCoords(5, 15), new MatrixCoords(-1, 0)); engine.AddObject(giftObject); //Gift Block GiftBlock giftBlock = new GiftBlock(new MatrixCoords(10, 10)); engine.AddObject(giftBlock); //UnpassableBlock UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(15, 15)); engine.AddObject(unpassableBlock); UnpassableBlock unpassableBlock1 = new UnpassableBlock(new MatrixCoords(15, 16)); engine.AddObject(unpassableBlock1); UnpassableBlock unpassableBlock2 = new UnpassableBlock(new MatrixCoords(15, 17)); engine.AddObject(unpassableBlock2); Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength); engine.AddObject(theRacket); //Creating second Racket //When you add second racket by addObject method, it checks whether the game has already a racket //If it does, we are removing the previous, and adding the new one. //Racket secondRacket = new Racket(new MatrixCoords(WorldRows -10, WorldCols / 2), RacketLength); //engine.AddObject(secondRacket); TrailObject trailObject = new TrailObject(new MatrixCoords(1, 1), 20); engine.AddObject(trailObject); for (int i = 0; i < WorldRows; i++) { IndestructibleBlock indestructibleBlockLeft = new IndestructibleBlock(new MatrixCoords(i, 0)); IndestructibleBlock indestructibleBlockRight = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1)); engine.AddObject(indestructibleBlockLeft); engine.AddObject(indestructibleBlockRight); } for (int i = 0; i < WorldCols; i++) { IndestructibleBlock indestructibleBlockCeiling = new IndestructibleBlock(new MatrixCoords(0, i)); engine.AddObject(indestructibleBlockCeiling); } }
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); }
public TrailObject CreateTrail() { TrailObject trail = new TrailObject(this.topLeft, new char[,] { { '.' } }, TrailLife); return trail; }