Why does the player loses health after leveling up? Will this be fixed in upcoming tutorials?
The player doesnât âloseâ health. The maximum health increases, so the difference between 8/10 health is less than 8/15 health. With 8/10 the player is at 80% health, but with 8/15 the player is at ~53% health. The health is still 8.
If I recall correctly, Sam does mention something about this somewhere in the course and offers up the choice to reset the playerâs health to max when they level up. But I canât remember if Iâm just imagining this
Thanks for the answer @bixarrio
Yes, Sam mentions something about this. However, at this point, if you kill an enemy with a ranged weapon (arrow or fireball), and thus donât engage in melee so you donât get hit by an enemy, and level up, it is weird to have your health decreased. Do you know what I mean?
I hope that this gets fixed somewhere later in the course.
Being an OG World of Warcraft player from back in the day, I tend to like the âSaved By Levelling upâ effect⌠This is where youâre in a big nasty battle with several baddies, and you are on the brink of death, just a couple hit points left when you kill a baddie and level up and BEWM 100% Health and Mana.
The âlossâ of health with the way Sam has the code is an illusion, you really are gaining health, but since itâs not setting to max-health, it will always look like you lost health on a percentage bar. If you put a text component on top of the health Bar showing the current health points and the max health points (like 50/75, for example), that helps untrick the mindâs perception that you lost health.
Alternatively, you can grant the player the full health he deserves by simply setting currentHealth to the new Max Health on Levelling up.
Personally, I like to increase both max and current health, so if my new level adds 5hp to my max, I add the 5hp to my current as well. If I was on 8/10, I will be on 13/15 after level up, and still only 2hp down. But I guess it depends on personal preference and what the game calls for
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.