How to Make a Great Health Bar in Godot 4 | Let's Godot

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ต.ค. 2024

ความคิดเห็น • 126

  • @kardrasa
    @kardrasa 9 หลายเดือนก่อน +75

    I challenged myself to make this from my head without doing the tutorial and I did it! Lets g0000!

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน +16

      Lets go brother, good job!

    • @vickylance
      @vickylance 5 หลายเดือนก่อน +1

      Did you implement it in any different approach?

    • @DT-hb3zu
      @DT-hb3zu หลายเดือนก่อน

      0:19 is where I'm commenting from.
      At first, I would think that there would be two health bars overlaid.
      The top bar moves down by percentage based on the hit.
      The second would stay, and only move down if the top bar hasn't moved in some arbitrary length of time.
      If the top bar value

  • @mannig.faltigkeit2341
    @mannig.faltigkeit2341 9 หลายเดือนก่อน +43

    The fact that you showed the general idea of the solution in the beginning (0:30) makes this tutorial S-tier in my book. ❤

  • @fooby7072
    @fooby7072 4 หลายเดือนก่อน +4

    I tried to implement this myself the last two days in my 3D isometric, but for the player health (tried to implement it into Camera script which I set as parent of the HealthBar). Thank you so much for this! Very nice and clear explanation, even though the part writing the actual script was a bit fast. Can't wait to get home and try it!

  • @Hindriux
    @Hindriux 6 หลายเดือนก่อน +4

    Amazing tutorial, especially the fact that you use the Healthbar as a component. Too many people just add canvas layers or add a healthbar directly to their scene. Thank you!

  • @QuietPenguinGaming
    @QuietPenguinGaming 7 หลายเดือนก่อน +2

    Your tutorials are SO good!! Thank you for making them :)

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน

      Much appreciated!

  • @Indiemat
    @Indiemat 8 หลายเดือนก่อน +2

    Great tutorial, very helpful! Keep up the good work!

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน +1

      Thank you so much! I appreciate it dude!

  • @D.E.Nicolas.Goncalves
    @D.E.Nicolas.Goncalves 6 หลายเดือนก่อน

    It was super valuable, it opened up a logic in my mind that can be used in other types of systems, THANKS!

  • @DeavtheDev
    @DeavtheDev 3 หลายเดือนก่อน

    Bro this works wonders! You explained it so perfectly and it actually works! Also the way you set it up it can be used for multiple different things such as players and enemies! Thank you so much! Liked the video and subscribed!

  • @yellowduckgamedev
    @yellowduckgamedev 9 หลายเดือนก่อน +3

    If you are making a fighting game, i would highly recommend to only change the damage indicator once a combo ends.

    • @felipezymor9970
      @felipezymor9970 2 หลายเดือนก่อน

      In case of someone that needs that, the way I did is the following:
      1: Disconnect the timeout signal from the Timer of the HealthBar
      2: Change the set_health function:
      func _set_health(_new_health):
      var previous_health = health
      health = min(max_value, _new_health)
      value = health

      if health timer.time_left:
      timer.disconnect("timeout", _on_timer_timeout)

      timer.connect("timeout", _on_timer_timeout)
      timer.start()
      else:
      damage_bar.value = health

  • @madeyslime
    @madeyslime 9 หลายเดือนก่อน +8

    quick suggestion: instead of making the damage bar snap to the right value after the combo, you can use a tween to make it move towards the right value! so it's smoother

    • @SleepyLazyPanda
      @SleepyLazyPanda 2 หลายเดือนก่อน

      Nice, but I don't know how to make a tween, would it work with a ease function or something?

    • @madeyslime
      @madeyslime 2 หลายเดือนก่อน +1

      @@SleepyLazyPanda yea but tweens are way better, i suggest you look into them !

    • @SleepyLazyPanda
      @SleepyLazyPanda 2 หลายเดือนก่อน

      @@madeyslime ok thanks !

    • @madeyslime
      @madeyslime 2 หลายเดือนก่อน +1

      @@SleepyLazyPanda you're welcome !!

  • @martinithechobit
    @martinithechobit 9 หลายเดือนก่อน +1

    Thank you. A simple aspect of a game but the work into it. Ty.

  • @zeqobopro9328
    @zeqobopro9328 3 หลายเดือนก่อน

    Thank you so much for this bro. you explained it very well

  • @Gamewithstyle
    @Gamewithstyle 9 หลายเดือนก่อน +1

    Very cool tutorial! Saving this one and will use it soon! Thanks man

  • @TheJazzygeoff
    @TheJazzygeoff 9 หลายเดือนก่อน

    Thanks, this was excellent, and I used it to make a 3D version that takes this and just makes a Sprite3D "Billboard" of it for my 3D game. I also put in a little tween as some have asked for so that the white part moves smoothly after the timer timeout.

  • @verigg6598
    @verigg6598 6 หลายเดือนก่อน +5

    The init_health function will not work because we have changed the var health : set function.
    In init_health the first two lines should be like this:
    max_value = _health
    health = _health
    then it will work correctly.

    • @pavelkrastev2949
      @pavelkrastev2949 5 หลายเดือนก่อน

      You are a life-saver!

    • @Baannia
      @Baannia 2 หลายเดือนก่อน

      Found this too )

    • @Lutnar
      @Lutnar หลายเดือนก่อน

      do you know why I'm getting null value on damage_bar in set_health function and same in init_health ?
      I did one to one from video changed what you wrote and still nothing

    • @verigg6598
      @verigg6598 หลายเดือนก่อน

      If you get an error like this: “Attempted to call function 'init_health' in base 'null instance' on a null instance.”
      Most likely you are trying to change values on a heatlhBar that has not yet passed _ready(). If you are trying to set the value of a heatlhBar, during the _init() of whoever owns it, move that to _ready().
      If you just can't change the value, check again that you haven't made a mistake in the code. Check that you may have forgotten @onready somewhere.

  • @rejecht_3042
    @rejecht_3042 2 หลายเดือนก่อน +1

    you can also spice up your healthbar by tweening it. It would look twice as better.

  • @user-ali1993-s5b
    @user-ali1993-s5b 9 หลายเดือนก่อน

    I just started learning Godot. This is helpful thank you 🌹

  • @mateuszparus
    @mateuszparus หลายเดือนก่อน

    Is it your mic picking up typing sound or some sort of software that adds it in post production? If it's the latter, what software is it?

    • @DashNothing
      @DashNothing  หลายเดือนก่อน

      @@mateuszparus It's MechaKeys

    • @mateuszparus
      @mateuszparus หลายเดือนก่อน

      @@DashNothing thanks

  • @NDL19
    @NDL19 8 หลายเดือนก่อน

    Hey man, I'm making my own game, and that health bar is cming in really handy for me,(Thank you so much!) but I don't have any enemy Sprites, do you have a recommened sprite, or atleast the ghost you used in your video?

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน

      You can search itch.io for free sprite packs, there's a lot of stuff on there. I also recommend, as do many other gamedev youtubers, Kenney's assets - www.kenney.nl/

  • @saveriov.p.7725
    @saveriov.p.7725 2 หลายเดือนก่อน

    I really liek that knockback effect when the ghosts die from being shot. Would you be able to share how you did that?

  • @luthfiramadhan7116
    @luthfiramadhan7116 9 หลายเดือนก่อน

    thanks a lot g! this work very well on my code

  • @ghb323
    @ghb323 9 หลายเดือนก่อน

    This should be standard in all video games because unlike numerical HP displays, a small damage is barely noticeable if displayed as a bar without a damage indicator where as numbers, you'll see the rightmost digit change (assuming no damage number shows) as numbers are very distinct visually than a bar.
    At 5:25 I would recommend swapping the damage and health to represent the amount healed in the event that HP is greater than previousHP.

  •  2 หลายเดือนก่อน

    Will this work also with TextureProgressBars? Or we need a different approach?

    • @DashNothing
      @DashNothing  2 หลายเดือนก่อน +2

      I haven't tried it, but I believe it will work the same.

    • @MB_Arssin
      @MB_Arssin 2 หลายเดือนก่อน +2

      @@DashNothing Yea it works, but in the parent node i just deleted "under" texture and left only progress one, then in DamageBar changed progress texture from normal to white and it works exacly the same. Thanks a lot. :P

  • @hrothgarnogar
    @hrothgarnogar 2 หลายเดือนก่อน

    Really cool tut, and I followed perfectly fine until I got to 6:38. You just already have this function set up for _set_health but obviously I wouldn't and don't have a function like that already set up. So where would I add the "healthbar.health = health" statement???

    • @DashNothing
      @DashNothing  2 หลายเดือนก่อน +1

      @@hrothgarnogar You update the healthbar's health any time your enemy's health changes.
      In this case I have a var health on the enemy and a setter function _set_health which gets called every time you try to assign a new value to a variable. Here's a little example of setting up getters and setters: forum.godotengine.org/t/how-to-use-godot-4-setget/5975/2
      Of course, you don't have to update healthbar's health inside a setter function. You can also do it when the enemy gets hurt, wherever that might be in your code. It's up to you.

    • @hrothgarnogar
      @hrothgarnogar 2 หลายเดือนก่อน

      @@DashNothing Super helpful thank you!!!

  • @kissjudasg59
    @kissjudasg59 8 หลายเดือนก่อน

    Hello bro, I need to know how your game is set up in Godot. Is there a way to download it? I want to test your configurations.

  • @ohhave3586
    @ohhave3586 9 หลายเดือนก่อน +1

    do you have a video where you show the on_dead and super._set_health(value) parts in more detail? at the moment they're returning errors in my script

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน +1

      No, I wanted to leave the health / damage / death implementation up to the viewer so the healthbar doesn't depend on it. Any way you approach doing health will work with the health bar.
      Here I used on_dead as a function defined in the parent Enemy script that can be overridden if needed. Also, var health is defined in the parent Enemy.gd so I call super._set_health() to trigger its setter first.

    • @ohhave3586
      @ohhave3586 9 หลายเดือนก่อน

      @@DashNothing thanks, is there any way you'd be willing to share your code for that section? I've just started game design and have found that putting together ideas from different videos/guides pretty tough.

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน +1

      @@ohhave3586 Here I made a gist with Enemy and BigGhost scripts:
      gist.github.com/DashNothing/2a0a54397826b4f3aaeb7d90d9f01c73

    • @ohhave3586
      @ohhave3586 9 หลายเดือนก่อน

      @@DashNothing That's awesome, thank you so much!

  • @micahrobbins8353
    @micahrobbins8353 3 หลายเดือนก่อน

    I don't underatand what max_value is doing or why we need to use min() instead of just using new_health?
    Edit: ok I think I get it, the _init_health parameter is passed in from the enemy script's _ready function. That means that the init_health function is only called once to set the max_value once, meanwhile newHealth changes each time var health is updated.
    min(Max_value, new_health) prevents the value from exceeding whatever is initially define as the maximum health

  • @JimKrillPDX
    @JimKrillPDX 12 วันที่ผ่านมา

    If you are using a setter for "health" and then change "health" inside the setter, wouldn't that result in recurssion? That's what is happening for me.

    • @DashNothing
      @DashNothing  11 วันที่ผ่านมา

      @@JimKrillPDX No because in Godot you have to manually assign the value to the property inside the setter, otherwise it won't change

  • @黄色的树枝
    @黄色的树枝 5 หลายเดือนก่อน

    Wow. exactly what i need

  • @TheRealKaiProton
    @TheRealKaiProton 9 หลายเดือนก่อน

    that was a great Simply explained, Speedy video.
    the thumb nail showed the bar with a different shape, wider at the start and narrow at the end, can that be implemented?
    I know Godot can have circular bars, but never seen wider to narrow.

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน +1

      This can't be done by only using the ProgressBar node. You would need to somehow make a mask that hides the progress bar in the shape you want. You would probably use a shader to get the masking effect on top of a sprite of the shape you want. It seems there's no built in way to mask nodes in Godot.

    • @TheRealKaiProton
      @TheRealKaiProton 9 หลายเดือนก่อน

      I bet shader is the way to go.

  • @SamuTheFrog
    @SamuTheFrog 4 หลายเดือนก่อน

    "otherwise we are talking about"
    - DashNothing

  • @Wisdawms
    @Wisdawms 9 หลายเดือนก่อน +1

    was waiting for you to use lerp or tween to smooth out that transition :(

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน +2

      I planned on doing it, but upon closer inspection a lot of fighting games don't even do that, so I decided against it. Easy to add though.

  • @Flux0_0-u2d
    @Flux0_0-u2d 3 หลายเดือนก่อน

    thank you

  • @MH-lr6ue
    @MH-lr6ue 7 หลายเดือนก่อน

    I kinda made the health bar but I don't have anything to attach it too so it kinda doesn't work for me lol. I made the health bar deplete if I click my LMB but that's it lol. It doesn't even delete the health in a nice animated fashion lol. I still have lots of learning to do.

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน +1

      It's all a learning process. You'll get there bro

  • @nickyoung414
    @nickyoung414 6 หลายเดือนก่อน

    My health bar is initializing value and decreasing in value correctly but visually it doesn't change from the value set in the editor. How can I fix this?

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน +1

      This would happen if the progress bar's max value field in the editor is less than your health value. Max value by default is 100, so you won't see a change until your health goes below 100. You can go into the healthbar scene and crank up this max value to something huge that you know you're not gonna need to go over.

  • @darkpalettegames009
    @darkpalettegames009 9 หลายเดือนก่อน

    nice video brother

  • @Shiva-om4oi
    @Shiva-om4oi 8 หลายเดือนก่อน

    Awesome please explain how to make enemies in godot

  • @DarknessSavior
    @DarknessSavior 7 หลายเดือนก่อน

    Is there a way to use this for the player's healthbar, and set up automatic health regen?

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน

      Yes, you'd do it similarly to how the enemies health works for damage. For regen you update the healthbar's health value in the same way. The bar will fill up without leaving any of the white underlying bar visible.
      Also, it can follow the player aor be static on the screen like a boss healthbar, no problem.

    • @DarknessSavior
      @DarknessSavior 7 หลายเดือนก่อน

      Could you give an example of how you'd code that?

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน

      @@DarknessSavior Maybe have a timer for the regen to kick off, and a var is_regenerating = false. Connect the regen timer timeout signal and set is_regenerating = true in the callback.
      In the _process() func check if is_regenerating and increase the health by a small amount, also updating the healthbar, as seen in the video. Check if health is already full, in which case set is_regenerating back to false.
      When the player takes damage you can call regen_timer.stop() to cancel any incoming regen, followed by regen_timer.start() to kick off a new attempt.
      This is just off the top of the dome piece. Try it and let me know how it went.
      Might make a video about this too.

  • @WiredGamesOfficial
    @WiredGamesOfficial 8 หลายเดือนก่อน +1

    I followed every step to the detail and the bar never updates I've been at this for 3 days.....

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน

      One thing that comes to mind is if you're using health that's over 100 you have to change both progress bars' max value property in the inspector to be more than that. Put a value that you know is bigger than you will ever use. Since they are set to 100 by default, they will just not show any difference for values greater than that.

    • @physis6356
      @physis6356 หลายเดือนก่อน

      @@DashNothing omg this fixed my problem, thanks!

  • @Lutnar
    @Lutnar หลายเดือนก่อน

    I'm getting null within init_health(_health) funtion in health bar and set_healthbar function getting null with damage_bar.value = health
    any ideas what I did wrong, I did exactly 1 to 1 from video

    • @DashNothing
      @DashNothing  หลายเดือนก่อน

      @@Lutnar You have to make sure yojr script has a _health var declared. For me this was in the parent Enemy script, so it's inherited. For you, you can declare right there at the top of the script.

    • @Lutnar
      @Lutnar หลายเดือนก่อน

      @@DashNothing I added var _health = 0 in my texture bar script and for good measure in my player script like you said but its still giving me null at the same lines
      hit_bar.value = health
      and
      max_value = health

    • @Lutnar
      @Lutnar หลายเดือนก่อน

      @@DashNothing its giving invalid set index "value" (on base : "nil" ) with value of type "float"
      in the line hit_bar.value = health and the same is in the script init_health with max_value and value

    • @Lutnar
      @Lutnar หลายเดือนก่อน

      @@DashNothing overall sry for spamming in comments but it works then I instatiate as child of my player but not when I instatiate to the overall world and now my hp bar is following player bcs its child of it
      how can I do that it works without adding it as a child of a player ?

    • @DashNothing
      @DashNothing  หลายเดือนก่อน

      @@Lutnar Oh that's a different story. Did you get the reference to hit_bar with @onready at the top of the script? If you have that line, make sure that the path to the health bar node is correct.

  • @Dlontong71
    @Dlontong71 2 หลายเดือนก่อน

    Help my health bar now lowering

  • @ULTRADARKSETH
    @ULTRADARKSETH หลายเดือนก่อน

    Again. Very helpful ! Really flexible . I would like to know your ideas behind the enemies super._set_health(value) if you don't mind.

    • @DashNothing
      @DashNothing  หลายเดือนก่อน +1

      @@ULTRADARKSETH Thank you!
      Every enemy inherits from the Enemy.gd script which has the var health and a setter function _set_health. When you use the keyword super you're calling something on the base script, in this case the Enemy.gd.
      So this sets the health to a new value. You can also define var health inside of each enemy's script if you don't have a lot of them, which would make this code slightly easier to follow. But having a base class for the Enemy is useful when you plan on having a lot of different ones that each use the same set of vars (like health).

  • @xx-ww9dk
    @xx-ww9dk 4 หลายเดือนก่อน +1

    Does this health bar work for player?

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน +2

      Yep, same principle regardless of what node uses it.

    • @xx-ww9dk
      @xx-ww9dk 4 หลายเดือนก่อน

      @@DashNothing thank you for answering

  • @dodomoko
    @dodomoko 9 หลายเดือนก่อน

    Any recommendations to make the healthbar float on top of the enemy instead of being static at the bottom of the screen?

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน

      5:50 is where I show it in the video

    • @dodomoko
      @dodomoko 9 หลายเดือนก่อน

      ​@@DashNothing I should have been more specific. I meant more in terms of if the enemy sprite changes (e.g., gets bigger or smaller) - how can you make sure the bar stays at the same relative height above the enemy

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน +1

      @@dodomoko If you put the sprite and the same healthbar under a common Node2D parent and then scale the parent instead, both will scale at the same time and remain proportional. This is the easiest solution, but the drawback is the proportions of the healthbar will not stay consistant with other healthbars (the border will be much thicker for example).
      Other solutions that come to mind:
      - animate the healthbar's position while you're animating the sprite scale (works only if you know the target scale in advance)
      - calculate the new healthbar position y by getting sprite.texture.get_size()..y * sprite.scale and set it in the process function or something
      Good luck bro!

  • @necrox7gaming186
    @necrox7gaming186 9 หลายเดือนก่อน +1

    i get the error: Attempt to call function 'init_health' in base 'null instance' on a null instance.

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน

      This means you didn't get the reference to the healthbar node in your enemy script. Either you didin't add the healthbar to the scene, didn't write the @onready var healthbar = $... line, or the name of your healthbar node and what you're trying to get in the @onready line don't match.
      Hope that helps!

    • @ponshop1742
      @ponshop1742 7 หลายเดือนก่อน +1

      @@DashNothing Month late, same issue as commenter above, but I've tried all of your fixes and it still is not working. Also says that health is not declared in the current scope but can that just be fixed by declaring health as a variable in the scene? I'm using it for my player character if that helps.

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน

      @@ponshop1742 Definitely add the health variable to your player script if that's where you're using the healthbar. Did you add the healthbar to the player scene? And did you use the instance scene button (chain icon)?

    • @ponshop1742
      @ponshop1742 7 หลายเดือนก่อน

      @@DashNothing Yep I've instanced the HealthBar scene into it, not sure why it isn't working

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน

      @@ponshop1742 The problem is your var healthbar is set to null because Godot couldn't find the healthbar in the scene. If the healthbar is in the scene also check if the spelling of the path to it is correct on the line @onready var healthbar = $...
      To make sure you can delete the path and just drag and drop the healthbar from the scene tree into the code editor. This will generate a correct path to it.

  • @rsutrainferno
    @rsutrainferno 4 หลายเดือนก่อน

    Does anyone know if this can be done with a texture progress bar?

  • @TheOnlyGhxst
    @TheOnlyGhxst 9 หลายเดือนก่อน

    Trying to figure out how to do this for a 3D game but sadly the same rules don't apply T_T

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน

      You can have UI elements in 3D space by using a viewport texture on a plane mesh. There are tutorials for it if you search for terms like "godot UI in 3D" or "godot viewport texture". Hope that helps!

  • @celsladroma8048
    @celsladroma8048 7 หลายเดือนก่อน +1

    why you so good at godot engine?

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน

      It's just practice. Making stuff. And I'm still learning with you with every video I make.

    • @celsladroma8048
      @celsladroma8048 7 หลายเดือนก่อน

      @@DashNothing will you doing it great... come on I'm just following you... and your channel is showing sign of good progress.. keep up the good work...

  • @Eliblack.
    @Eliblack. 8 หลายเดือนก่อน

    look cool

  • @SinnaMon-s9p
    @SinnaMon-s9p 6 หลายเดือนก่อน

    is there a way to add this to a 3d scene?

    • @SinnaMon-s9p
      @SinnaMon-s9p 6 หลายเดือนก่อน

      update, nvm i just learned it overlaps the 3d scene, dont need an answer thanks!

  • @bluefox7628
    @bluefox7628 5 หลายเดือนก่อน

    "_set_health()" not found in base CharactedBody2D

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน

      It's a function we define ourselves to be the setter for the health variable.

    • @bluefox7628
      @bluefox7628 5 หลายเดือนก่อน

      @@DashNothing oh alright :))

  • @MEMEBEAN6960
    @MEMEBEAN6960 8 หลายเดือนก่อน

    What is the on_dead = die

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน

      The enemy parent script has an on_dead callable which can optionally be assigned a function. Since the parent script takes care of deleting the scene when health reaches 0, it also calls on_dead first so any custom behaviour (like changing the sprite and emitting dust particles) which is defined in the child script, can happen first.

  • @magasinmaytex7974
    @magasinmaytex7974 6 หลายเดือนก่อน

    Why does the Health Bar not change color?
    extends Area2D
    var pMeteorEffect := preload("res://Meteor/MeteorEffect.tscn")
    var minSpeed: float = 20
    var maxSpeed: float = 30
    var minRotationRate: float = -20
    var maxRotationRate: float = 20
    @onready var healthbar = $Healthbar
    var health: int = 20
    var speed: float = 0
    var rotationRate: float = 0
    var playerInArea: Player =null
    func _ready():
    healthbar.init_health(health)
    speed = randf_range(minSpeed, maxSpeed)
    rotationRate = randf_range(minRotationRate, maxRotationRate)

    func _process(delta):
    if playerInArea != null:
    playerInArea.damage(1)

    func _physics_process(delta):
    rotation_degrees += rotationRate * delta

    position.y += speed * delta
    func damage(amount: int):
    health -= amount
    if health

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน

      In the code you posted where exactly are you attempting to change color? I don't see it.

    • @magasinmaytex7974
      @magasinmaytex7974 6 หลายเดือนก่อน

      @@DashNothing
      Thanks, don't worry, I fixed it

  • @fragrantfart826
    @fragrantfart826 7 หลายเดือนก่อน +1

    I tried changing the color based on percentage of health remaining if health < prev_health:
    timer.start()
    if health

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน

      This is how I did it by duplicating the theme stylebox first:
      var theme_stylebox = get_theme_stylebox("fill").duplicate()
      theme_stylebox.bg_color = Color("#6e9f29")
      add_theme_stylebox_override("fill", theme_stylebox)

    • @fragrantfart826
      @fragrantfart826 7 หลายเดือนก่อน

      @@DashNothing Thank you!