Jump to content

Paint XP Drop


Swizzbeat

Recommended Posts

Thanks to @Jack for sparking the idea QwPha8E.png

 

Variables:

int currentXP;
int gainedXP;
int drawXP;
int screenWidth = 520;
int screenHeight = 337;
double yMovement;
int alpha = 255; 

In your onStart method:

currentXP = client.getSkills().getExperience(Skill.YOUR_SKILL);

Code for your onPaint method:

gainedXP = client.getSkills().getExperience(Skill.YOUR_SKILL);

if (gainedXP != currentXP) {
    drawXP = gainedXP - currentXP;
    currentXP = client.getSkills().getExperience(Skill.YOUR_SKILL);
    yMovement = 0;
    alpha = 255;
}
if (drawXP != 0 && alpha > 1) {
    g.setColor(new Color(255, 255, 255, alpha -= 2));
    String drawString = "+ " + drawXP;
    int stringLength = (int) g.getFontMetrics().getStringBounds(drawString, g).getWidth();
    g.drawString(drawString, screenWidth / 2 - stringLength / 2, (int) ((screenHeight / 2) - (yMovement += .7)));
}

If you're drawing other things after this remember to set the color back to what you want!! Here's what it looks like in game:

a1ca5fca8f2d3b4d519e546d5df4222c.gif

Edited by Swizzbeat
  • Like 2
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...