public Draw ( |
||
gameTime | ||
batch | BitmapBatch | |
position | Vector2 | |
spriteEffects | SpriteEffects | |
return | void |
/// <summary> /// Draws the animated player. /// </summary> public void Draw(GameTime gameTime, BitmapBatch batch) { // Flip the sprite to face the way we are moving. if (Velocity.X > 0) { flip = SpriteEffects.FlipHorizontally; } else if (Velocity.X < 0) { flip = SpriteEffects.None; } // Draw that sprite. sprite.Draw(gameTime, batch, Position, flip); }
/// <summary> /// Draws the animated enemy. /// </summary> public void Draw(GameTime gameTime, BitmapBatch batch) { // Stop running when the game is paused or before turning around. if (!Level.Player.IsAlive || Level.ReachedExit || Level.TimeRemaining == TimeSpan.Zero || waitTime > 0) { sprite.PlayAnimation(idleAnimation); } else { sprite.PlayAnimation(runAnimation); } // Draw facing the way the enemy is moving. SpriteEffects flip = direction > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; sprite.Draw(gameTime, batch, Position, flip); }