All pastes #2069833 Raw Edit

Miscellany

public text v1 · immutable
#2069833 ·published 2011-05-27 04:39 UTC
rendered paste body
public static void NewText(Rectangle location, Color color, string text)
{
    for (int i = 0; i < 100; i++)
    {
        if (!Main.combatText[i].active)
        {
            Vector2 vector = Main.fontCombatText.MeasureString(text);
            Main.combatText[i].alpha = 1f;
            Main.combatText[i].alphaDir = -1;
            Main.combatText[i].active = true;
            Main.combatText[i].scale = 0f;
            Main.combatText[i].rotation = 0f;
            Main.combatText[i].position.X = (location.X + (location.Width * 0.5f)) - (vector.X * 0.5f);
            Main.combatText[i].position.Y = (location.Y + (location.Height * 0.25f)) - (vector.Y * 0.5f);
            Main.combatText[i].position.X += Main.rand.Next(-((int) (location.Width * 0.5)), ((int) (location.Width * 0.5)) + 1);
            Main.combatText[i].position.Y += Main.rand.Next(-((int) (location.Height * 0.5)), ((int) (location.Height * 0.5)) + 1);
            Main.combatText[i].color = color;
            Main.combatText[i].text = text;
            Main.combatText[i].velocity.Y = -7f;
            Main.combatText[i].lifeTime = 60;
            return;
        }
    }
}