How to have a dynamic Experience bar?

Hey guys,

So i followed the tutorial for the HUD, all works fine… however the experience bar only goes from 0-1. I have my level up cost changing each time you level up to become more expensive…

How do i set it so the experience bar max number changes to meet this changing cost?

I would suggest having two variables in your widget blueprint, Exp and MaxExp. Then, bind your progress bar to a function GetExpProgress, which simply returns Exp / MaxExp. When your character levels up, update the widget’s MaxExp variable, and any time your character gains experience, update the Exp variable.

This is assuming that your Exp gets reset to zero as soon as you level up. If that’s not the case, then you probably want to also store the previous level’s MaxExp somewhere, and GetExpProgress would look like

(Exp - PrevMaxExp) / (MaxExp - PrevMaxExp)

Worked perfect, can’t believe it was just xp / max xp…I obviously don’t do maths…