About 'Display Player Health'!

In this video (objectives)…

  1. Create DisplayHealth.cs and follow a similar path to displaying our score.

After watching (learning outcomes)…

Display the player's health on the screen and reset it after dying.

(Unique Video Reference: 32_LD_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

Within my ProcessHit method I added a line to stop the health displaying as a negative value:

		if (_health <= 0)
		{
			_health = 0;    //this line here
			Die();
		}

Makes it that little bit tidier if you take huge amounts of damage.

5 Likes

This topic here also provides a good solution to the negative values for Health display.

Privacy & Terms