private void DrawHeartDropAnimationFrame(SpriteBatch sb, int frame, int maxFrames) { int x = 0; int y = 0; HUDHealthBarHelpers.GetTopHeartPosition(Main.LocalPlayer.statLife, ref x, ref y); y += frame * 2; var rect = new Rectangle(x, y, this.HeartTex.Width, this.HeartTex.Height); float percentProgress = frame / maxFrames; float alpha = 0.5f - (percentProgress * 0.5f); sb.Draw(this.HeartTex, rect, Color.White * alpha); }
//////////////// private void DrawSubHealthAtPercent(SpriteBatch sb, float percent) { int width = this.HeartTex.Width; int height = (int)((float)this.HeartTex.Height * percent); var srcRect = new Rectangle(0, 0, width, height); int x = 0; int y = 0; HUDHealthBarHelpers.GetTopHeartPosition(Main.LocalPlayer.statLife, ref x, ref y); var destRect = new Rectangle(x, y, width, height); sb.Draw(this.HeartTex, destRect, srcRect, Color.Black * 0.5f); }