public override void Draw(SpriteBatch sb, Map gameMap) { _idleAnim.Draw(sb, Position, _faceDir == -1?SpriteEffects.None:SpriteEffects.FlipHorizontally, _scale, Rotation, _tint); if (Position.X >= 0 && Position.X < 200) { _idleAnim.Draw(sb, Position + new Vector2(gameMap.Width * gameMap.TileWidth, 0), _faceDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, _scale, Rotation, _tint); } if (Position.X >= (gameMap.Width * gameMap.TileWidth) - 200 && Position.X < (gameMap.Width * gameMap.TileWidth)) { _idleAnim.Draw(sb, Position - new Vector2(gameMap.Width * gameMap.TileWidth, 0), _faceDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, _scale, Rotation, _tint); } if (_hitAlpha > 0f) { _hitAnim.Draw(sb, Position, _faceDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, _scale, Rotation, _tint * _hitAlpha); if (Position.X >= 0 && Position.X < 200) { _hitAnim.Draw(sb, Position + new Vector2(gameMap.Width * gameMap.TileWidth, 0), _faceDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, _scale, Rotation, _tint * _hitAlpha); } if (Position.X >= (gameMap.Width * gameMap.TileWidth) - 200 && Position.X < (gameMap.Width * gameMap.TileWidth)) { _hitAnim.Draw(sb, Position - new Vector2(gameMap.Width * gameMap.TileWidth, 0), _faceDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, _scale, Rotation, _tint * _hitAlpha); } } base.Draw(sb, gameMap); }
public void Draw(SpriteBatch sb, Map gameMap, SpriteFont font) { if (!Active) { return; } if (_upAnim.State == SpriteAnimState.Playing) { _upAnim.Draw(sb, Position, faceDir == -1?SpriteEffects.FlipHorizontally : SpriteEffects.None); } else if (_downAnim.State == SpriteAnimState.Playing) { _downAnim.Draw(sb, Position, faceDir == -1?SpriteEffects.FlipHorizontally : SpriteEffects.None); } else { _idleAnim.Draw(sb, Position, faceDir == -1?SpriteEffects.FlipHorizontally : SpriteEffects.None); } if (_hitAlpha > 0f) { if (_upHitAnim.State == SpriteAnimState.Playing) { _upHitAnim.Draw(sb, Position, faceDir == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1f, 0f, Color.White * _hitAlpha); } else if (_downHitAnim.State == SpriteAnimState.Playing) { _downHitAnim.Draw(sb, Position, faceDir == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1f, 0f, Color.White * _hitAlpha); } else { _idleHitAnim.Draw(sb, Position, faceDir == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1f, 0f, Color.White * _hitAlpha); } } if (_powerUpText > 0f) { sb.DrawString(font, "POWER UP", Position + new Vector2(0f, -10f + (5f * _powerUpText)) + Vector2.One, Color.Black * _powerUpText, 0f, font.MeasureString("POWER UP") / 2, 1f, SpriteEffects.None, 0); sb.DrawString(font, "POWER UP", Position + new Vector2(0f, -10f + (5f * _powerUpText)), Color.White * _powerUpText, 0f, font.MeasureString("POWER UP") / 2, 1f, SpriteEffects.None, 0); } base.Draw(sb, gameMap); }
public override void Draw(SpriteBatch sb) { //_idleAnim.Draw(sb, Position); _runAnim.Draw(sb, Position, FaceDir == -1?SpriteEffects.FlipHorizontally:SpriteEffects.None, 1f, 0f, _tint); base.Draw(sb); }