Search Unity

Health PickUps

Discussion in '2D' started by Oryam_Bibi_Roubi, Feb 12, 2020.

  1. Oryam_Bibi_Roubi

    Oryam_Bibi_Roubi

    Joined:
    Dec 18, 2019
    Posts:
    1
    Hi Im Trying To Crate An Health PickUp And Its Just Decreasing My Health Pls Help
    BTW Here Is My Code:

    if(other.tag == "Heart" && currentHealth < maxHealth)
    {
    currentHealth = currentHealth + 15;

    Destroy(other.gameObject);
    }
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    Hi @Mr_T3co

    Please use code tags when posting code... this forum is already quite polluted with first time poster's posts that are not edited to use code tags, even if someone mentions that.

    Other than that - the problem must be something else / somewhere else than in this piece of code, as you are clearly adding to currentHealth. And the question is so vague it is really hard to help... = more details.