Esempio n. 1
0
            public override void Draw(GameTime gameTime, SpriteBatch spriteBatch, Camera camera)
            {
                float w = Value / (float)MaxValue;

                //Draw the innerbar with the width corresponding to the value.
                sprite.Draw(spriteBatch, origin, scale, DrawColor, new Rectangle(GlobalPosition.ToPoint() - (cameraSensitivity * camera.GlobalPosition).ToPoint(), new Point((int)(w * Width), (int)(8 * scale))));
            }
Esempio n. 2
0
    public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        base.Draw(gameTime, spriteBatch);

        //draw Healthbar, above the enemy
        DrawRectangle(new Rectangle(GlobalPosition.ToPoint() - new Point(50 - sheetRec.Width / 2, 60), new Point(100, 14)), spriteBatch, Color.Black, 2, 1f);
        Color healthColor = new Color((int)(255 * (1 - (health / maxHealth))), (int)(255 * (health / maxHealth)), 0, 255);

        DrawRectangleFilled(new Rectangle(GlobalPosition.ToPoint() - new Point(50 - sheetRec.Width / 2, 60), new Point((int)((health / maxHealth) * 100), 14)), spriteBatch, healthColor, 0.8f);
        DrawText(spriteBatch, FNT_LEVEL_BUILDER, ((int)(health)).ToString(), GlobalPosition + new Vector2(sheetRec.Width / 2, -53), Color.Black, true);
    }
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     drawRectangle.Location = LocationOverride ? LocalPosition.ToPoint() : GlobalPosition.ToPoint();
 }
 public override void Initialize()
 {
     drawRectangle = new Rectangle(GlobalPosition.ToPoint(), _size);
 }