public void newGame(int NumOfPlayers, List <Player> players) { name = new List <char>(); scene = new Scene(); scene.GenerateMap(); keys = new List <Keys>(); StartGameTimer.Start(); flashTimer = false; playersLocal = new List <Player>(); isNewHighScore = false; isGameOver = false; gbHighScore.Visible = false; gbHighScore.Enabled = false; ifGameStarted = false; positionOfText = 0; enteredKeyAfterEndGame = false; BomberMan b1 = new BomberMan(players[0].Name, startingPoints[0], Keys.Up, Keys.Down, Keys.Left, Keys.Right, Keys.Space, BomberMan.CHARACTER.Blue); b1.Key = startingPoints[0]; BomberMan b2 = new BomberMan(players[1].Name, startingPoints[1], Keys.W, Keys.S, Keys.A, Keys.D, Keys.E, BomberMan.CHARACTER.Yellow); b2.Key = startingPoints[1]; BomberMan b3 = null; if (NumOfPlayers == 3) { b3 = new BomberMan(players[2].Name, startingPoints[2], Keys.NumPad8, Keys.NumPad5, Keys.NumPad4, Keys.NumPad6, Keys.NumPad0, BomberMan.CHARACTER.Red); b3.Key = startingPoints[2]; } scene.AddPlayer(b1); scene.AddPlayer(b2); if (NumOfPlayers == 3) { scene.AddPlayer(b3); } Invalidate(); }
/// <summary> /// Explodes the bomb /// </summary> public void ExplodeBomb(Bomb bomb, BomberMan man) { Point left, right, up, down; bool LeftPass, RightPass, UpPass, DownPass; DownPass = LeftPass = RightPass = UpPass = true; left = right = up = down = bomb.Coordinates; for (int i = 1; i <= bomb.ExplodesionRadius; i++) { if (i == 1) { Map.Tiles[bomb.Coordinates].DestroyBlock(); man.Kill(BomberMen, Map.Tiles[bomb.Coordinates]); Map.Tiles[left].WhoPlaced.Bombs.Remove(bomb.Coordinates); Map.placedBombs.Remove(bomb.Coordinates); } if (LeftPass) { left = new Point(bomb.Coordinates.X - 50 * i, bomb.Coordinates.Y); LeftPass = explode(left, man); } if (RightPass) { right = new Point(bomb.Coordinates.X + 50 * i, bomb.Coordinates.Y); RightPass = explode(right, man); } if (UpPass) { up = new Point(bomb.Coordinates.X, bomb.Coordinates.Y + 50 * i); UpPass = explode(up, man); } if (DownPass) { down = new Point(bomb.Coordinates.X, bomb.Coordinates.Y - 50 * i); DownPass = explode(down, man); } } }
/// <summary> /// Adds the player to the Scene /// </summary> public void AddPlayer(BomberMan bomberMan) { BomberMen.Add(bomberMan); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); P1Sheet = Content.Load<Texture2D>(@"P1"); P2Sheet = Content.Load<Texture2D>(@"P2"); map = Content.Load<Map>("Map1"); map.LoadTileSheets(xnaDisplayDevice); // TODO: use this.Content to load your game content here bomberman1 = new BomberMan(Keys.Up, Keys.Down, Keys.Left, Keys.Right, new Vector2(32, 32), P1Sheet, new Rectangle(0, 0, 32, 32), Vector2.Zero, map.Layers[0]); bomberman2 = new BomberMan(Keys.W, Keys.S, Keys.A, Keys.D, new Vector2(22 * 32, 23 * 32), P2Sheet, new Rectangle(0, 0, 32, 32), Vector2.Zero, map.Layers[0]); bomberman1.Tagged = true; }
/// <summary> /// Increase the bombs that the player can carry /// </summary> public override void PowerUp(BomberMan b) { b.IncreaseBombs(); }
/// <summary> /// Increase the speed of the player /// </summary> public override void PowerUp(BomberMan b) { b.IncreaseVelocity(); }
/// <summary> /// Increase the radius of the bomb /// </summary> public override void PowerUp(BomberMan b) { b.IncreaseExplosionRadius(); }
public abstract void PowerUp(BomberMan b);