private void CreateStopBoard() { int windowCenterX = (BricksOutGame.WindowWidth - LeftBorderWidth - InfoFieldWidth) / 2; int boardYPos = 725; stopBoard = new StopBoard(boardSprite, windowCenterX, boardYPos, boardLeftFireSprite, boardRightFireSprite); }
/// <summary> /// Updates the fire animation. /// </summary> /// <param name="gameTime">The game time.</param> /// <param name="board">The stop board the fire is bursting from.</param> public void Update(GameTime gameTime, StopBoard board) { if (playing) { drawRectangle.X = board.DrawRectangle.X + (int)posInBoard.X; drawRectangle.Y = board.DrawRectangle.Y + (int)posInBoard.Y; PlayAnimation(gameTime); } }
/// <summary> /// Creates a new fire that burst from the board. /// </summary> /// <param name="sprite">The sprite sheet for the board fire.</param> /// <param name="x">The x position relating to the board.</param> /// <param name="y">The y position relating to the board.</param> /// <param name="board">The stop board.</param> public BoardFire(Texture2D sprite, int x, int y, StopBoard board) { spriteStrip = sprite; frameWidth = spriteStrip.Width / FramesPerRow; frameHeight = spriteStrip.Height / NumRows; numFrames = FramesPerRow * NumRows; posInBoard = new Vector2(x, y); int xPos = board.DrawRectangle.X + (int)posInBoard.X; int yPos = board.DrawRectangle.Y + (int)posInBoard.Y; drawRectangle = new Rectangle(xPos, yPos, frameWidth, frameHeight); sourceRectangle = new Rectangle(0, 0, frameWidth, frameHeight); }