How to Create UPDATING Health Bars in Godot 4

Поділитися
Вставка
  • Опубліковано 22 кві 2023
  • In this video we are going to go over how to create updating health bars step by step in Godot, health bars are really important but this video goes hand in hand with creating any type of UI element that you need in your game, health bar, stamina bar, etc. Having a health bar in your godot game can make your game look much better because now you are able to see the players health while playing the game!
    Download Free art pack: game-endeavor.itch.io/mystic-...
    make sure to download the free as that is all we will need for this series.
    Link RPG Godot 4 series playlist: • How to Make an RPG in ...
    ----------------------------------------------------------------------------------------------------------------------------------------
    Thank you so much for watching I really hope this video helped.
    if you did enjoy then please go and click that subscribe button to help out the channel. I means so much and I love your feedback in the comments to let me know what it is that you enjoyed. Again thanks so much and I would love to see you again!
    have a great rest of you day and of course be safe :)
    - thanks DevWorm,
    ----------------------------------------------------------------------------------------------------------------------------------------

КОМЕНТАРІ • 130

  • @PunCala
    @PunCala 9 місяців тому +48

    Typical gamer: *dies to enemy* -> goes into files to nerf the enemy instead of getting good.

    • @Soroosh.S83
      @Soroosh.S83 9 місяців тому +5

      Lmao but seriously sometimes there is no way that U gonna get good, grinding is waste of time and no fun

  • @moac8
    @moac8 7 місяців тому +12

    One of the best tutorial series I've ever seen. I understood Godot better in a hundred minutes than in other brain-burning hour-long series. thank you.

    • @dev-worm
      @dev-worm  7 місяців тому +3

      so glad to hear!!!

  • @zynxos
    @zynxos 9 місяців тому +23

    Great video! This helped out a lot, and I also have a note that I would like others to read:
    If you want the ProgressBar to be a UI element, add Canvas node on your Player's scene, and and make the ProgressBar a child of the Canvas node. The Progress bar is now a UI element that displays wherever you want.

  • @catastrophe15
    @catastrophe15 5 місяців тому +9

    "Dude, you are literally a genius!" Is what I kept saying out loud when I saw the finished product of each video. To everyone reading, this dude is literally the greatest. He is funny, explains the code, walks you through, etc. He has helped me start on the path of achieving my dream of being a Game Developer. I subscribed immediately within 5 minutes of the first video. I am so excited to see more GODOT tutorials! Thanks, DevWorm! Keep up the amazing work!

    • @dev-worm
      @dev-worm  5 місяців тому +3

      thank you so much brother!! this made my day!! Hope I'm able to keep helping you out more and more! If you ever need anything then please let me know!

    • @catastrophe15
      @catastrophe15 5 місяців тому +4

      @@dev-worm Sounds awesome dude, I'd love to stay in contact. I'm glad it made your day! As soon as I finished this video I went around showing everyone 🤣

  • @ipodblade
    @ipodblade Рік тому +4

    Back to back videos I love it!

  • @telsv4227
    @telsv4227 9 місяців тому +4

    Hey man, I went through all of this playlist and honestly found them all helpful. Yea, it's not the best way of doing probably any of it but what a great learning exercise to clean it up... maybe add some composition and a state machine? Those are my next steps. Thanks for the playlist, definitely subbed and liked it all.

  • @Michael-eb8nf
    @Michael-eb8nf 9 місяців тому +4

    Long time animator, first time programmer. I've been enjoying this playlist of videos, they have been extremely helpful making my own first project. I'd really love to see a tutorial on giving a player a dash or roll, its the one thing I have been struggling a lot with and it's driving me crazy.

  • @HippocritterXD
    @HippocritterXD 9 місяців тому +4

    i loved this tutorial. it was very fun to do and you explain the process very well. i have zero exp with game making and i could understand it well enough to follow it. cant wait to start another one

    • @dev-worm
      @dev-worm  9 місяців тому +2

      so glad to hear that!

  • @opalnights
    @opalnights 7 місяців тому +3

    thank you so much for this guide. you are the goat. going to build off this now, thank you. had a lot of bugs i ran into but was able to overcome them : )

    • @dev-worm
      @dev-worm  7 місяців тому +1

      so happy to hear that

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

    Thanks For The Tutorials!!!
    Just
    Very Helpful And Easy To Understand For Me Who Didnt Have Any Coding Knowledge And Bad With English.
    AlreadyFinished The Tutorial And Now Trying To Improve By Myself.
    Cant Wait For The Crazy Tutorials Project You Talked About!!!

  • @Underduckie-Gamer
    @Underduckie-Gamer 2 місяці тому +2

    Thank you so much dev-worm for all your hard work in making this series. I can't believe how easy it is to create an actual video game. I am going to have so much fun making and playing my own game!

    • @dev-worm
      @dev-worm  2 місяці тому +1

      glad they were helpful! thank you!! It means the world to me! Goodluck on your game dev journey! and if you ever need help then dont be afraid to reach out!

  • @pietraderdetective8953
    @pietraderdetective8953 Рік тому +11

    Awesome video!
    Thank you for your contribution to the Godot 4 community ❤

    • @dev-worm
      @dev-worm  Рік тому +3

      thanks bro, many more to come soon!

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

      @@dev-worm Hey man, thank you so much for the tut. Please do not stop :)

  • @naemnikdub
    @naemnikdub 11 місяців тому +2

    thank you very much for the playlist , it helped me a lot the day I started my project !

  • @tomoyaokazaki2138
    @tomoyaokazaki2138 2 місяці тому +1

    i typically play games where the healthbar was visible at all times. I decided to make it the way you did in your video and I'm glad I did. Absolutely no errors or issues encountered! :D I can't wait to check out your other videos like your Survival Game tutorial!

    • @dev-worm
      @dev-worm  2 місяці тому +2

      thanks!! and glad it was helpful! if you ever need anything then please let me know!

    • @tomoyaokazaki2138
      @tomoyaokazaki2138 2 місяці тому +1

      @@dev-worm i greatly appreciate it! I just now watched your survival video for moving in all 8 directions and tried adding that (and commenting out the 4 direction movement). Now, the movement is all messed up.
      Walking animation doesn’t play and neither does the attack animation.
      And the directions that I coded in the script (from that video aren’t making the player move in those correct directions).
      I’m using Godot 4.2 btw. Is there a way I can fix this?

  • @Kate_Mew_
    @Kate_Mew_ 4 місяці тому +1

    Thank you so much for these - i am making a godot game for my thesis in univesity and it helped me alot.

    • @dev-worm
      @dev-worm  4 місяці тому

      so glad I could help!! if you need anything specific then please let me know!

  • @th1rstyhnose760
    @th1rstyhnose760 10 місяців тому

    I love ur content bro, never stop doing that

  • @TutnichtsZumCode
    @TutnichtsZumCode 3 місяці тому +1

    great video and series. much appreciated!

    • @dev-worm
      @dev-worm  3 місяці тому +1

      thank you so much!

  • @ferosaito4368
    @ferosaito4368 5 місяців тому +1

    Great tutorial. I will definitely check more!

    • @dev-worm
      @dev-worm  5 місяців тому +1

      so happy it was helpful!! thank you! if you need anything then please let me know!

  • @Einwilliger
    @Einwilliger Місяць тому +1

    Hi!
    I have now ignited the game and I find it really easy thanks to you!
    This was also my first game I did with Godot.
    I would like to ask if you could not maybe continue the series because there was an update to the assets pack with skeletons and new map sharing!
    Would be really cool!
    Have a new subscriber❤

    • @dev-worm
      @dev-worm  Місяць тому

      so happy to hear!! thank you so much!! maybe Ill start to think about covering more topics with this series!

  • @2btitan
    @2btitan 4 місяці тому +1

    Great tutorial from start to finish thanks !

    • @dev-worm
      @dev-worm  4 місяці тому +1

      happy to hear! thank you!

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

    Thank you for these, they're very helpful

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

    Keep up the good work!

  • @mr.pickleworldbuilding
    @mr.pickleworldbuilding 7 місяців тому

    Instead of doing
    if health 0:
    Anyways, great tutorial, I've learned so much from this series!

  • @Rikikiz
    @Rikikiz 9 місяців тому +1

    Awsome series !

  • @quojo5757
    @quojo5757 Місяць тому +2

    You are the GOAT, awesome tutorial

    • @dev-worm
      @dev-worm  Місяць тому +1

      Glad it helped!! thank you!

    • @quojo5757
      @quojo5757 Місяць тому +1

      @@dev-worm Hey, i have one question, how would i make the enemy slime stop all of the idle and other animations and play a "hurt" animation when it gets hit? I searched on the Godot forums but most of them were unanswered. And some were too complicated.

  • @BigBossRazz
    @BigBossRazz Рік тому +2

    After going through this series, I just wanted to say that it was super informative and great! I know some comments were like, "Why didn't you do THIS?" or "If you did THIS it would've been a lot easier" or "THIS would be the way to make it more readable", but I really enjoyed how you walked us through what you did and WHY you did it in your way. It's helped someone like me who has some beginner knowledge of Game Dev and coding kind of see how and why someone like me could approach a project like this.
    Thanks for your hard work, and I can't wait to see your future tutorials!

    • @dev-worm
      @dev-worm  Рік тому +2

      so glad i could help, so much coming really soon

  • @Relderf
    @Relderf Рік тому +5

    Awesome guide, I learned a lot :) I will now try to implement changes to it.

    • @dev-worm
      @dev-worm  Рік тому +3

      glad you learned a lot! huge tutorials coming soon so you can try to implement them into this game. like dialogue

  • @Film_it_all
    @Film_it_all Місяць тому +1

    Great series

    • @dev-worm
      @dev-worm  Місяць тому

      thanks!! hope it provided lots of value!

  • @user-yr3bu2om1o
    @user-yr3bu2om1o 21 день тому

    Well thank you, i watch this all. This is easy mechanics, but looks good for beginner

    • @dev-worm
      @dev-worm  21 день тому

      thank you so much!! goodjob!

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

    Thanks this looks amazing #subscribed

  • @BlendFin
    @BlendFin Рік тому +2

    Thank you!

  • @Cluxiu
    @Cluxiu 5 місяців тому

    Thank You Sir.

    • @dev-worm
      @dev-worm  4 місяці тому

      of course anytime!

  • @user-vh8my5pg6m
    @user-vh8my5pg6m 5 місяців тому

    Thanks, man

    • @dev-worm
      @dev-worm  5 місяців тому

      thanks brother! hope it was helpful!

  • @DRND12
    @DRND12 Рік тому +2

    Thanks

  • @eveningrice
    @eveningrice День тому

    Great tutorial! I feel a lot more comfortable with the interface now, and have a good idea of nodes the gd script now, as well as camera + world building. I was even able to pause your tutorial and finish the tasks you started in a couple of the videos, and more or less ended up with the same solution.
    I do have one problem though, it seems the cooldown for the player dealing damage to the enemy doesn't seem to work. I still seem to one-shot kill him. Can't figure it out!
    Have a lot more confidence to push through and start my dev log journey! Thanks

    • @dev-worm
      @dev-worm  2 години тому +1

      thank you for sharing, i am so happy to hear that!! it means the world to me!! remember if you ever need anything just let me know!! i’m so proud of how much you have been able to learn goodjob!

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

    Could you make a tutorial on collecting let’s say gems and when you pick one up it adds a gem to the ui under the health bar

  • @felipelima4175
    @felipelima4175 2 місяці тому

    Hey, amazing tutorial you have but I have a problem I can't figure it out. When the player attacks it instantly kills the enemy and it was working before impleting healthbars. Could you share your github repository for me to compare or give me some help?

  • @GalaxyJammed
    @GalaxyJammed Рік тому +4

    5:10 Can you give a more detailed explanation on adding the health bar on different corners? (E.x top left?) Im a bit stuck

    • @joshua.h
      @joshua.h 9 місяців тому

      If you wanted to make the healthbar be in a fixed position of the screen, you would probably want to have a different scene to handle HUD stuff. There are many tutorials for making HUDs in Godot so I'm sure you could find one to help you with that. Hope this helps!

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

    Bro pls make more parts this game can be made more good

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

    how would you go about making an enemy play a attack animation if using your script. I tried using the same as the player but it wont work

  • @ALEKSONEARTH
    @ALEKSONEARTH 11 місяців тому

    Ayo, any plans to get into procedural generation, of maps and enemies and all that?

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

    can you do a tutorial on the animation finish func that the animated sprite has

  • @ReverofEnola
    @ReverofEnola 2 місяці тому

    Thank you so much for this tutorial sereis but I am unfortunately having trouble exporting this particular project.

    • @ReverofEnola
      @ReverofEnola 2 місяці тому

      Nevermind figured it out lol. I just had the wrong files setup in my editor settings & was rendering the wrong scenes.

    • @dev-worm
      @dev-worm  2 місяці тому

      glad you were able to fix it!! Goodjob!

  • @user-rm7pz4cy6u
    @user-rm7pz4cy6u 2 місяці тому

    Парень спасибо за уроки !

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

    Can you make a tutorial on how to make dpad for mobile control?

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

    Finishing up the whole series now, I love it, really appreciate your effort in creating something beautiful, fun e nice to follow along while we learn about Godot. Nothing is better than to learn by doing. Thank you @dev-worm 🥰😍😍

    • @dev-worm
      @dev-worm  Місяць тому +1

      Glad you like them! Thank you so much!! it means the world to me that it was such a help!!

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

    can this work for 3d games? like having the health bar display on the enemies?

  • @plugzly-x613
    @plugzly-x613 8 місяців тому

    idk why I'm getting an error after healthcare.value = health. identifier "health" not declared in the current scope

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

    bro can you make a video on how to add a death animation

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

    great video, but i was wondering. how do we use the death animations that got inserted into the animated sprite 2D?
    I attempted to do it but the enemy just keeps on dissappearing before the animation plays out.

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

      I haven’t tried and I’m not very good at godot since I just started but using the knowledge I gained from this series I would say make a wait() in your code after the animation then make the enemy disappear or make a timer to implement into your code

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

      I just checked this and if you add a timer to the enemy and say if health is 0:, you also have to go to the else (the one where right below it, it goes to idle animation) and change to elif not player_chase and health > 0:, that should make it work you just have to set the timer so the death animation plays right

  • @inicomputer8892
    @inicomputer8892 27 днів тому

    I watch all yr tutorial and ihve done make all off it. I need more can u add gathering resource like mining cutting tree

    • @dev-worm
      @dev-worm  26 днів тому

      that would be something important to cover.. thanks for letting me know! Ill start looking into creating a tutorial over it!! thanks for the idea!

  • @mathislalonde353
    @mathislalonde353 5 місяців тому

    I wonder, I see that all these videos were released 9 months ago, did you all release them at the same time?
    I'm going back to episode 1 to continue the tutorial... xD

    • @dev-worm
      @dev-worm  5 місяців тому +1

      they were all around the same time yes! I think maybe 2-3 days in-between each one!

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

    I just don't understand the semantics of gd script...
    E.g. we had multiple times in the source: "if boolVar == true:" -> Can't you use "if boolVar:" ?
    We process the health bar always in the physics function, why not just implement it in a setter of the player/enemy health?
    (there are more "unusual" source lines)
    I'm really missing something here, it would be nice to explain all the things that would be solved differently in other languages...
    Besides of this:
    Thanks for the videos!

  • @skymr2848
    @skymr2848 2 місяці тому

    I wanted to add an obstacle that would damage the player when it touches it but you didnt show the way to code a dmg system..

  • @thesomeone2nd
    @thesomeone2nd 11 місяців тому +3

    How do we apply death animations tho? I tried playing the animations before calling queue_free on both the player and the enemy but didnt worked. Any help maybe?

    • @julieazure6994
      @julieazure6994 8 місяців тому +1

      i had that same exact problem. Any ideas on how to apply them? :c

    • @thesomeone2nd
      @thesomeone2nd 8 місяців тому +2

      @@julieazure6994 I don't remember the project but in general I think now that if you want something to die you connect a signal from a hurt box area(area 2d node) to the node that you want to die and after you get reference of the area in code you say e.g.
      HitBox.set_deferred("monitorable", false)
      animation.play("death")
      await animation.animation_finished
      queue_free()
      Not too sure though if you can try something like that.

    • @julieazure6994
      @julieazure6994 8 місяців тому +1

      @@thesomeone2nd thnx a bunch. Definetely trying that 👀👌🏻

  • @GalaxyJammed
    @GalaxyJammed Рік тому +4

    Id like to ask if there is any possibility to turn that health bar into hearts in the top left screen (for the player) and top right screen (for the enemy)? Much thanks ❤

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

      I believe you would need to use Textureprogress , which allows you to put in the heart texture rather than using a default progress!

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

      @@TheMaJestic14 I still am completely clueless on how to do that 😅

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

      @@GalaxyJammed its kinda hard explaining through text , will try to find you a video but you own me a sub deal? XD

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

      @@GalaxyJammed this video goes over what you want i think , its godot 3.5 but not much changed except some lines ua-cam.com/video/7A4EPIr-6Sc/v-deo.html

    • @GalaxyJammed
      @GalaxyJammed Рік тому +2

      @@TheMaJestic14 tysm ill give it a try

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

    I have a problem, when the enemy hits me and I receive damage and then I heal, my character becomes immortal because he no longer receives damage and I entered the code as it appears in the video, can someone help me?;-;

  • @th1rstyhnose760
    @th1rstyhnose760 10 місяців тому

    How Can I respawn the enemy in the same position after 20 sec when he dies?

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

    when ever you die you zoom out do you know how to fix it

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

    Is this the last episode?

  • @GandpaIsBetter
    @GandpaIsBetter 10 місяців тому +2

    hey wondering about re spawning and adding more enemy ( like randomly spawning them in your map ) and thank you for the vid
    edit: im also wondering about making the movement wasd instead of arrow keys

    • @dev-worm
      @dev-worm  10 місяців тому +1

      to change the input you would need to go to project settings, input map.. then change what keys do what accordingly. respawning enemys is coming soon in the survival series that Im currently working on.

  • @learninggodot
    @learninggodot 10 місяців тому

    Regin timer? I think you mean Regen 😂
    Thanks for the info tho

  • @AzdineDZ
    @AzdineDZ 11 місяців тому

    can you show all the script from the beginning to the end

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

    Bro can you please upload a video about platform enemy ai Pathfinder with auto jumps pleasssseeeeee❤❤❤😀😃😃😃😃😃

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

    Please explain how you do a control of phone, your follower from Morocco 🇲🇦🙏🏻❤️

    • @dev-worm
      @dev-worm  Рік тому

      working on a series for a mobile game

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

    If your healthbar is not showing up, it is because the healthbar cannot be higher than 100. You have to set up the healthbar to 100. To avoid this and use custom health, I added a variable "max_health" and set the healthbar to the max_health of the Player or Enemy instance. And also: If your health is not regenerating, do not forget to activate "Autostart" on the timer.
    func update_health():
    var healthbar = $healthbar
    healthbar.max_value = max_health
    healthbar.value = health

    if health >= max_health:
    healthbar.visible = false
    else:
    healthbar.visible = true
    func _on_region_timer_timeout():
    if health < max_health:
    health = health + 20
    if health > max_health:
    health = max_health
    if health

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

    im begging you to upload this whole project, I cannot get the enemies to take or give damage and i've watched the whole thing twice, I really need help :,(

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

      Mines the player wont give damage lol. enemy hits me just fine

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

    Do you continue this series with invetory system?

    • @dev-worm
      @dev-worm  8 місяців тому

      working on an really good inventory system tutorial that will be uploaded in like one day!

    • @user-vw1nl2vo4e
      @user-vw1nl2vo4e 7 місяців тому +1

      Its been a month

  • @WPCraft
    @WPCraft 11 місяців тому +1

    no signal 'timeout' method not found... idk what going on.

    • @WPCraft
      @WPCraft 11 місяців тому

      when i run app it's running but not regen any hp.

    • @WPCraft
      @WPCraft 11 місяців тому

      Ok there was my bad. I cleared all and repeat from zero and all work properly.

  • @McUsmox21
    @McUsmox21 2 місяці тому

    Bro im making rpg game but i have so much bugs 😢😢😢

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

    give as the link of Project pls🙏🙏

    • @dev-worm
      @dev-worm  Рік тому

      sorry i forgot to add it to the description, ill make sure to do it on all future uploads

  • @BadApple-um7vb
    @BadApple-um7vb 19 днів тому

    i hope you can provide source code

  • @inyoke1241
    @inyoke1241 11 місяців тому +1

    Nice! i wanna kiss you!. ty for all. hopes see future videos with 4.1. always something change. likes delta. i had to change to _delta

  • @seedoforigin
    @seedoforigin 10 місяців тому

    lol 12:07

  • @joshuamahunye9056
    @joshuamahunye9056 9 місяців тому +1

    YOU SAVED MY LIFE THANK YOU SO MUCH MR DEVOLOPER WORM]

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

      MR DEVELOPER WORM IS THE CLUTCH KING