Easy Heart Health System in Unity

Поділитися
Вставка
  • Опубліковано 22 лис 2024

КОМЕНТАРІ • 49

  • @opxv
    @opxv 2 роки тому +10

    This is like the reincarnation of Brackeys... easy to understand, follow and build upon. Thank you!

  • @xavvey
    @xavvey 2 роки тому +9

    I watch a lot of gamedev channels on youtube and I can say that there aren't a lot of (maybe 1 or 2. There was Brackey but he quit...) those that give these clear, understandable, easy to follow and great small videos! I have been searching a while for this before you popped up on my feed!

    • @BMoDev
      @BMoDev  2 роки тому +2

      Thats a big compliment! thanks

  • @mandamoon9149
    @mandamoon9149 2 роки тому +3

    Bmo videos have single handedly dropped my cholesterol and now my heart is healthy ❤️

  • @kristinewestman5502
    @kristinewestman5502 8 місяців тому

    So easy to understand. I spent all day trying to get my health system to work. Watched many different videos. Tried my own ideas. Then I found this! Thank you so much. Now, I can get on with the rest of my game.

  • @emsaik8202
    @emsaik8202 2 роки тому +5

    I'm finding your videos really helpful, they inspired me to start learning more about unity and start making my first game so thanks for the work!!

    • @BMoDev
      @BMoDev  2 роки тому

      wooo lets gooo, make a masterpiece I'm always looking for something fun

  • @suicune2001
    @suicune2001 2 роки тому +3

    Thanks! I need to get more familiar with those layout groups. They seem very useful for getting buttons and such in a nice neat order.

  • @Stompin40
    @Stompin40 2 роки тому +3

    Sick video! Very helpful!

  • @eileeng2492
    @eileeng2492 2 роки тому +1

    Thank you for the clear tutorial and explanation
    Much appreciated

  • @DivyanshuLohani
    @DivyanshuLohani 2 роки тому

    Bro very much thank you I literally was stuck on this problem for 3 days

  • @Overlord-vm3gm
    @Overlord-vm3gm 2 роки тому +3

    fucking hell i just spoke to a mate about how to add health system and boom 10 minutes later this video recommended on home page
    but great video and thanks

    • @BMoDev
      @BMoDev  2 роки тому +2

      haha typical - appreciate it!

  • @noanfelipe4753
    @noanfelipe4753 9 місяців тому

    Great video! helped a lot

  • @vvcephie113
    @vvcephie113 2 роки тому +5

    Can you please do a tutorial on how to do 2 players with one keyboard. (WASD)(Arrow Keys) This would be very helpful to me and probably a lot of other people because there is not another 2d 2 player video with gravity. Thanks. BTW love the vids, subbed

    • @madpenguin58
      @madpenguin58 2 роки тому

      All you need to do is create another set of axi in your inut system, or just have map the buttons and have a way to tell the script which player is which

  • @adimortal3195
    @adimortal3195 Рік тому +1

    can you explain a liittle bit of this OnPlayerDamaged event ?
    because i only using
    health = health - 1
    every time it taking damage

  • @dashadventure9952
    @dashadventure9952 2 роки тому +1

    Please a new and improved 2d top down movement tutorial

  • @VFORVICTORY1000
    @VFORVICTORY1000 2 роки тому +2

    HElpful thx

  • @puffosgamingoldchannel5992
    @puffosgamingoldchannel5992 Рік тому +1

    Hey, I have ran into a problem with the script for the health bar. I have done everything you stated to do (even changing some numbers to make the UI work in my favour) and for some reason the hearts just don't want to change sprites.
    I am trying to do a quarter health system (minimum of 0, maximum of 4) and whenever I tried to change the health of the player the sprites for the hearts would never change, they would always be full.
    I am honestly scratching my head on this one and I can't find a solution to this problem, really want to learn how to do this health system as it would help immensely in a project I'm working on and would help me in the future on other projects.

  • @wortwortwort117
    @wortwortwort117 4 місяці тому

    So what would we do if we wanted each heart to only be one health

  • @weckar
    @weckar 4 місяці тому

    Why not just make the hearts a mask for a variable length health bar underneath? Then you can have any fraction at a whim and even animate it draining down without additional sprite graphics.

  • @MaizaMriza
    @MaizaMriza 2 роки тому +8

    I ran into scaling issues after following the guide. Everything works correctly except every time a new prefab is instantiated the scaling was set to 45,45,45 and the heart would basically be huge af. To fix that I had to set the scaling in the code. under CreateEmptyHeart method I just added one line: newHeart.transform.localSacle = new Vector3(1,1,0) this should fix the problem if you run it to it as well. It could be because I used a random heart image from google. !

    • @mitygamedev5882
      @mitygamedev5882 Рік тому +1

      it could be because you touched the settings in Grid Layout (or you should and did not) the default was 100x100 i changed to 64x64 for my project and works perfect.

  • @antonmayer7891
    @antonmayer7891 2 роки тому +1

    Hi this video is really helpfull but I managed to run into an issue anyways. When I start my game all hearts are there but empty. As soon as my Player takes damage all hearts fill excapt of that what I lost. So now everything is working properly again. Can u help me...?

  • @Tonesko5
    @Tonesko5 2 роки тому +1

    Anybody know my it won't let me assign my player to the player health

  • @raulmelgar8903
    @raulmelgar8903 Рік тому

    THANK YOU!!!!!!!!

  • @brianpizarro2744
    @brianpizarro2744 2 роки тому

    Thank you

  • @yojan69
    @yojan69 2 роки тому

    help, why does it rests 2 hp (a whole heart) if i did set "takedamage 1"?, my game has 20hp, 10 hearts, i can't find why :(

  • @taraskhan475
    @taraskhan475 6 місяців тому

    I like this, but please don't spawn in stuff without notice, like code and such

  • @NothingburgerOnG
    @NothingburgerOnG Рік тому +1

    My hearts dont update when im damaged? everything else works and i get the console meesage that i have died but the hearts dont change?

    • @shockingchris9809
      @shockingchris9809 Рік тому +1

      I am getting a similar issue. What seems to happen is that the named "HealthHeartBars" Or whatever better name people have is active and enabled and it appears it won't reinvoke or enter the method since it does not disable or go inactive. My thought is the set it inactive and set it active again, but I feel like there is some circular logic here to reference the UI HeartBars within the "PlayerHealth" script (or whatever you call yours).

    • @NothingburgerOnG
      @NothingburgerOnG Рік тому

      @@shockingchris9809 haha its been a while since i used this tutorial. I think i fixed it in the end but dont know how. My games was great tho

  • @danielduduleanu7517
    @danielduduleanu7517 2 роки тому

    I had default settings, yet somehow my hearts are placed from top to bottom instead of left to right. Do you have any ideea why?

  • @TahneeEvans
    @TahneeEvans Рік тому

    How do you get this to work if you are using public health and maxHealth floats within the HealthHeartManager script?

    • @blaze9433
      @blaze9433 Рік тому +1

      You just gotta do it like he first showed. Instead of referencing the playerhealth script, use "public float health, maxHealth;"
      Then, just substitute those parameters everywhere in the script where he referenced playerhealth.

  • @Anerisian
    @Anerisian 2 роки тому +1

    The “crazy math” part is not necessary. You see, hearts are either full or empty, except for one “broken” heart in between. It should be easy to find where the broken heart is at i.
    the logic is simply:
    int fullHearts = healthCurrent / 4;
    and then in the for loop…
    if (i < fullHearts) set the full heart image here.
    if (i == fullHearts) set the broken heart here.

  • @trstation3172
    @trstation3172 2 роки тому +2

    ı love you

  • @yamaNGap
    @yamaNGap 2 роки тому

    how do i make a script if i want each enemy type to have different damage?

    • @lucky6961
      @lucky6961 Рік тому

      just the damageoncollision script from 1 to the value you want, example if you want the void to instant-kill you can instead just make it set to 0 meaning death

    • @tirilmariepedersen6956
      @tirilmariepedersen6956 Рік тому

      I suggest looking into Scriptable Objects, this was a game changer for me C:
      SO stores data for you, so you can have everything from:
      Enemy name
      Health
      Speed
      Damage
      Prefab of the enemy containing ex: sprite, animator etc
      And so on..
      Then you can instantiate the prefab in the data container and voila! A enemy with the current data values emerges
      And then u can keep making more by making more SO with different enemies.
      Oh! You can make SO with anything; weapons, objects, player appearance.. :3
      It's AMAZING! :D
      Cheers

  • @godzillakingkongvenom
    @godzillakingkongvenom 2 роки тому +2

    Holllaaa

  • @felixalcatraz7489
    @felixalcatraz7489 Місяць тому

    doesn't work :l

  • @郑竣谦-d5n
    @郑竣谦-d5n 2 роки тому

    pm me script pleash

  • @Electorch
    @Electorch Рік тому

    public void Hp()
    {
    if (three.sprite != emptyHeart)
    {
    if (three.sprite == fullHeart)
    {
    three.sprite = halfHeart;
    }else if (three.sprite == halfHeart)
    {
    three.sprite = emptyHeart;
    }
    }
    else if (two.sprite != emptyHeart)
    {
    if (two.sprite == fullHeart)
    {
    two.sprite = halfHeart;
    }else if (two.sprite == halfHeart)
    {
    two.sprite = emptyHeart;
    }
    }else if (one.sprite != emptyHeart)
    {
    if (one.sprite == fullHeart)
    {
    one.sprite = halfHeart;
    }else if (one.sprite == halfHeart)
    {
    one.sprite = emptyHeart;
    }
    }
    }

  • @exderdunn
    @exderdunn 7 місяців тому

    this is very disappointing I really wanted to make it for 3D but this is not for 3D this is for 2D so thanks for absolutely nothing

    • @TheGrassKing
      @TheGrassKing 7 місяців тому +1

      thats not how that works you can still do that for 3d