1
\$\begingroup\$

I am using the following code to handle experience points gains:

reqXP = (Level ^ 2 + Level + 3) * 4

    If (currXP >= reqXP) Then

        Level = Level + 1
        expPoints = expPoints + 3

        excessXP = currXP - reqXP

        currXP = excessXP

        excessXP = 0

    End If

lbl_XP.Text = "Experience : " & currXP & " / " & reqXP

However, whenever I level up, it won't update the reqExp Label until I get my next batch of experience points.

What do I need to change to make this work?

\$\endgroup\$
2
  • \$\begingroup\$ What programming language is that? \$\endgroup\$
    – Philipp
    Jul 26 '17 at 19:26
  • \$\begingroup\$ How is this question unclear? \$\endgroup\$
    – Vaillancourt
    Jul 27 '17 at 8:03
2
\$\begingroup\$

Just add the "reqXP = (Level ^ 2 + Level + 3) * 4" if the player levels up. Actually you should only calculate it once the player levels up and keep the variable instead of calculating it every frame (if that's what you are doing)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.