public override void Update(GameTime gameTime) { if (bombs.Count() > 0) { for (int i = 0; i < bombs.Count(); i++) { if (bombs[i].isTimeForDelete(gameTime)) { Bomb bomb = bombs[i]; bombs.RemoveAt(i); BombermanGame.getInstance().soundsEffects["bomb"].Play(); buildFire(bomb, gameTime); return; } } } if (fires.Count() > 0) { for (int i = 0; i < fires.Count(); i++) { destroySolidBlocks(fires[i].getCurrentPosition()); if (fires[i].isTimeForDelete(gameTime)) { fires.RemoveAt(i); return; } } } BonusFactory.getInstance().generateBonus(gameTime); }
public static Background getInstance(bool requireNewInstance = false) { if (Background.background == null || requireNewInstance) { Background.background = new Background(new Rectangle(0, 0, BombermanGame.getInstance().GraphicsDevice.Viewport.Width, BombermanGame.getInstance().GraphicsDevice.Viewport.Height)); } return(Background.background); }
public void drawPoints(GameTime gameTime, String player, Color color, Vector2 vector) { ; BombermanGame.getInstance().spriteBatch.DrawString( BombermanGame.getInstance().visualScore[player], player + ": " + BombermanGame.getInstance().scoreByBomberman[player].ToString(), vector, color); }
protected Dictionary <int, Texture2D> buildImagesRoutes(String route) { Dictionary <int, Texture2D> images = new Dictionary <int, Texture2D>(); DirectoryInfo filesRoute = new DirectoryInfo("Content/" + route); FileInfo[] files = filesRoute.GetFiles("*"); for (int i = 0; i < files.Count(); i++) { images.Add(i, BombermanGame.getInstance().Content.Load <Texture2D>(route + files[i].Name.Replace(".xnb", ""))); } return(images); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); if (!initializedEnviromentSound || gameTime.TotalGameTime.Subtract(tiempo).Seconds > 19) { MediaPlayer.Play(BombermanGame.getInstance().sounds["enviroment"]); tiempo = gameTime.TotalGameTime; initializedEnviromentSound = true; } if (!initializedInvisible) { buildInvisibleBlocks(); } if (!initializedSolid) { buildSolidBlocks(); } foreach (Block block in listBlocks) { block.Draw(gameTime); } foreach (Bomb bomb in bombs) { bomb.Draw(gameTime); } foreach (Fire fire in fires) { fire.Draw(gameTime); } foreach (Bonus bonus in bonus) { bonus.Draw(gameTime); } BonusFactory.getInstance().generateBonus(gameTime); }
public override void Update(GameTime gameTime) { if (this.isKeyDownAndNot(controller.getUp())) { updateImage(gameTime, controller.getUp()); this.modifyBombermanPosition(controller.getUp()); } if (this.isKeyDownAndNot(controller.getDown())) { updateImage(gameTime, controller.getDown()); this.modifyBombermanPosition(controller.getDown()); } if (this.isKeyDownAndNot(controller.getLeft())) { updateImage(gameTime, controller.getLeft()); this.modifyBombermanPosition(controller.getLeft()); } if (this.isKeyDownAndNot(controller.getRight())) { updateImage(gameTime, controller.getRight()); this.modifyBombermanPosition(controller.getRight()); } if (Keyboard.GetState().IsKeyDown(controller.getAction()) && gameTime.TotalGameTime.Subtract(tiempoBomba).Milliseconds > 500) { tiempoBomba = gameTime.TotalGameTime; Bomb bomb = new Bomb(new Rectangle(base.currentFrame.X, base.currentFrame.Y, base.currentFrame.Width, base.currentFrame.Height), gameTime.TotalGameTime); Background.getInstance().addBombs(bomb); } if (Background.getInstance().intersectBonus(this.currentFrame)) { BombermanGame.getInstance().soundsEffects["bonus"].Play(); BombermanGame.getInstance().scoreByBomberman[player] += 1; } }
public virtual void Draw(GameTime gameTime) { BombermanGame.getInstance().spriteBatch.Draw(image, this.currentFrame, Color.White); }
public Sprite(String imagePath, Rectangle currentFrame) { this.image = BombermanGame.getInstance().Content.Load <Texture2D>(imagePath); this.currentFrame = currentFrame; }