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, 2017 at 19:26
  • \$\begingroup\$ How is this question unclear? \$\endgroup\$
    – Vaillancourt
    Jul 27, 2017 at 8:03

1 Answer 1

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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .