/// <summary> /// A health bar to display the player's health /// </summary> /// <param name="win">The window to draw to</param> /// <param name="position">The initial position of the health bar</param> public HealthBar(ref RenderWindow win, Vector2f position) : base(ref win) { var fillColor = new Color(138, 7, 7, 125); _mainRect = new RoundedRectangle(new Vector2f(200.0f, 75.0f), 5, 4) { FillColor = Color.Transparent, Position = position, OutlineThickness = 3 }; _healthText = new Text() { Position = new Vector2f(_mainRect.Position.X + 30, _mainRect.Position.Y), DisplayedString = AssetManager.GetMessage("Health"), Color = Color.Black, Font = AssetManager.LoadFont("OrangeJuice"), CharacterSize = 60 }; var healthSize = _mainRect.GetSize(); _innerRects = new List <Shape>(); for (var i = 0; i < (int)healthSize.X / 20; i++) { var rect = new RectangleShape() { Position = new Vector2f(_mainRect.Position.X + (i * 10 * 2.0f), _mainRect.Position.Y), OutlineThickness = 1, FillColor = fillColor, Size = new Vector2f(20.0f, 75.0f), OutlineColor = Color.Transparent }; _innerRects.Add(rect); _numToDraw++; } }