Example #1
0
        private void buildFire(Bomb bomb, GameTime gameTime)
        {
            Rectangle actualPosition = bomb.getCurrentPosition();
            Rectangle topPosition    = new Rectangle(actualPosition.X, actualPosition.Y - actualPosition.Height, actualPosition.Width, actualPosition.Height);
            Rectangle botPosition    = new Rectangle(actualPosition.X, actualPosition.Y + actualPosition.Height, actualPosition.Width, actualPosition.Height);
            Rectangle leftPosition   = new Rectangle(actualPosition.X - actualPosition.Width, actualPosition.Y, actualPosition.Width, actualPosition.Height);
            Rectangle rightPosition  = new Rectangle(actualPosition.X + actualPosition.Width, actualPosition.Y, actualPosition.Width, actualPosition.Height);

            fires.Add(new Fire(actualPosition, gameTime.TotalGameTime));
            if (!this.intersectInvisibleBlocks(topPosition))
            {
                fires.Add(new Fire(topPosition, gameTime.TotalGameTime));
            }
            if (!this.intersectInvisibleBlocks(botPosition))
            {
                fires.Add(new Fire(botPosition, gameTime.TotalGameTime));
            }
            if (!this.intersectInvisibleBlocks(leftPosition))
            {
                fires.Add(new Fire(leftPosition, gameTime.TotalGameTime));
            }
            if (!this.intersectInvisibleBlocks(rightPosition))
            {
                fires.Add(new Fire(rightPosition, gameTime.TotalGameTime));
            }
        }
Example #2
0
 private void createBomb(GameTime gameTime)
 {
     if (gameTime.TotalGameTime.Subtract(tiempo).Milliseconds > 500)
     {
         tiempo = gameTime.TotalGameTime;
         Bomb bomb = new Bomb(new Rectangle(base.currentFrame.X, base.currentFrame.Y, base.currentFrame.Width, base.currentFrame.Height), gameTime.TotalGameTime);
         if (!Background.getInstance().intersectBombs(bomb.getCurrentPosition()))
         {
             Background.getInstance().addBombs(bomb);
         }
     }
 }