Search Unity

HP points for my character.

Discussion in 'Scripting' started by marcos4503, Nov 2, 2015.

  1. marcos4503

    marcos4503

    Joined:
    Nov 1, 2015
    Posts:
    76
    I wonder how HP put points on my main character of my game 2d.

    Thank you.
     
  2. flonch

    flonch

    Joined:
    Aug 20, 2014
    Posts:
    63
    What? Are you asking how to give your character hit points (HP)?
    If so, just store the HP as an integer in the appropriate script, then decrease the value of the HP when taking damage.

    Or am I misunderstanding your question?
     
  3. marcos4503

    marcos4503

    Joined:
    Nov 1, 2015
    Posts:
    76
    Excuse me, I will be more accurate. I already had no idea that it was necessary an entire variable for HP, and reduce the value of it as my character received damage. More what I'd like to know is:

    - How to set this variable
    - Entering the program that reduces the value of this variable
    - How to make the character go to a game over screen when life reaches zero.

    Thanks for listening. Please can teach me, program, or point me to links me to study it?

    I'm new in unity!
     
  4. flonch

    flonch

    Joined:
    Aug 20, 2014
    Posts:
    63
    Nanako likes this.
  5. marcos4503

    marcos4503

    Joined:
    Nov 1, 2015
    Posts:
    76
    Thanks, I'll start studying now!