We call UpdateLevel() when experience is gained. When that happens, the level will either go up or stay the same. When an XP is gained, level cant go down right? So why are we checking if newLevel > currentLevel? Why not just use currentLevel = CalculateLevel()?
I believe you will by firing off an event when the level changes, soon. You only want to do this if the player’s level went up. So, you need to know what it was before the change. You can even see it in your screenshot. Without the check, that print message will appear even if the player didn’t level up.
Ahh its done to check whether to fire of the events or not. I was only thinking about updating the value of currentLevel. Thanks.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.