public void Draw(SpriteBatch spriteBatch, Player.PlayerDirection dir, float depth, PlayerSpriteTypes spriteType, Vector2 offset) { int iYOffSet = 0; if (spriteType == PlayerSpriteTypes.Wading || spriteType == PlayerSpriteTypes.Underwater) { iYOffSet = 8; } else { iYOffSet = -4; } sourceRect = new Rectangle((int)spriteType * FrameWidth, 0, FrameWidth, FrameHeight); destinationRect = new Rectangle((int)(ScreenPosition.X + offset.X), (int)(ScreenPosition.Y + iYOffSet + offset.Y), FrameWidth, FrameHeight); if (dir == Player.PlayerDirection.Left) { spriteBatch.Draw(spriteStrip, destinationRect, sourceRect, color, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, depth); } else { spriteBatch.Draw(spriteStrip, destinationRect, sourceRect, color, 0, Vector2.Zero, SpriteEffects.None, depth); } }
public void Draw(SpriteBatch spriteBatch, Player.PlayerDirection dir, float depth, int frameID) { sourceRect = new Rectangle((int)frameID * FrameWidth, 0, FrameWidth, FrameHeight); destinationRect = new Rectangle((int)ScreenPosition.X, (int)ScreenPosition.Y, FrameWidth, FrameHeight); spriteBatch.Draw(spriteStrip, destinationRect, sourceRect, color, 0, Vector2.Zero, dir == Player.PlayerDirection.Left ? SpriteEffects.None : SpriteEffects.FlipHorizontally, depth); }
public override void Draw(SpriteBatch spriteBatch, Player.PlayerDirection dir, float depth, Vector2 offset) { var frame = _frames[currentFrame]; var sourceRect = new Rectangle(0, 0, frame.Width, frame.Height); var drawRect = new Rectangle((int)(destinationRect.X + offset.X), (int)(destinationRect.Y + offset.Y), destinationRect.Width, destinationRect.Height); // Only draw the animation when we are active if (Active && _flickerDisplay) { spriteBatch.Draw(_frames[currentFrame], drawRect, sourceRect, color, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, depth); } }
public virtual void Draw(SpriteBatch spriteBatch, Player.PlayerDirection dir, float depth, Vector2 offset) { if (Active) { if (_delayStart <= 0) { var drawRect = new Rectangle((int)(destinationRect.X + offset.X), (int)(destinationRect.Y + offset.Y), destinationRect.Width, destinationRect.Height); // Only draw the animation when we are active if (dir == Player.PlayerDirection.Left) { spriteBatch.Draw(spriteStrip, drawRect, sourceRect, color, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, depth); } else { spriteBatch.Draw(spriteStrip, drawRect, sourceRect, color, 0, Vector2.Zero, SpriteEffects.None, depth); } } } }
// Draw the Animation Strip public void Draw(SpriteBatch spriteBatch, Player.PlayerDirection dir, float depth) { Draw(spriteBatch, dir, depth, new Vector2(0, 0)); }